JTextfield listening for changes from other class

Hi,

Assuming I have a Jtextfield in one of the class1 extend Jframe,

how do I update the jtextfield so that it could up make accessible by other class and continuously updated to reflect the input for value rom another class2.

In other words very much similar to the observable model view concept

class 1 may be look like

private void initComponents() {

jTextField1 = new javax.swing.JTextField();

jButton1 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jTextField1.setEditable(false);

class 2 may be look similar to the following

public void out_1(){

setStop1("N");

for (int i=1;i<100;i++){

class_1.getJTextField1().setText(String.valueOf(i));// System.out.println(i);

setOuti(i);

setStop1("N");

}

[888 byte] By [tsg-8888a] at [2007-11-27 11:52:28]
# 1

If I understand the question, then you just share the model between the two text fields. Something like:

JTextField textField1 = new JTextField();

JTextField textField2 = new JTextField( textField1.getDocument() );

camickra at 2007-7-29 18:44:40 > top of Java-index,Desktop,Core GUI APIs...
# 2

Hi,

Thank

Actually I would like to the Jtextfeld in one of the Desktop Jframe to be make accessible by others class may be using setXXX and getXXX

May be one could understand betters if I explain my idea in the scoreboard panel display concept.

Assuming Jtextfiled is the digital scoreborad display in the main desktopPane to display number of record being processed as well the total number of record matched , and unmatched like below

Record processed99999

record matched 1

record not matched99998

Upon query from perform by the other class 2 , the textfield in class 1 would be updated from the processing result in the class 2 in realtime upon class 2 execution .

class 1 and class 2 are in the same package , but not related or inherited .

tsg-8888a at 2007-7-29 18:44:40 > top of Java-index,Desktop,Core GUI APIs...