Sincronizar valores JTextFields por PropertyChangeListener

Eu quero copiar o valor de umjTextField - TXTFLD1 para outrojTextField -TXTFLD2 quando o valor em TXTFLD1 for alterad
Eu escolhopropertychangelistener porque não consigo detectar quando o valor em TXTFLD1 é alterado, porque é alterado por algum código externo que não posso modificar agor

O código de teste é o seguinte:


public class TxtFldSync extends JFrame {
    private JButton BTN1 = null;
    private JTextField TXTFLD1 = null;
    private JTextField TXTFLD2 = null;

    public static void main(String[] args) {
            TxtFldSync thisClass = new TxtFldSync();
            thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            thisClass.setVisible(true);
    }
    public TxtFldSync() {
        super();
        this.setSize(300, 200);
        BTN1 = new JButton();
        BTN1.setBounds(new Rectangle(178, 38, 67, 17));
        TXTFLD1 = new JTextField();
        TXTFLD1.setBounds(new Rectangle(32, 42, 83, 20));

        TXTFLD2 = new JTextField();
        TXTFLD2.setBounds(new Rectangle(30, 78, 83, 20));

        //listeners
        TXTFLD1.addPropertyChangeListener("value", new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent arg0) {
                TXTFLD2.setText(TXTFLD1.getText()+"set by change listener");
                //this doesnot work why ?
            }
        });
        BTN1.addActionListener( new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                TXTFLD1.setText("Action Performed");
                //i what to set same value to TXTFLD2 using property change listener
            }
        });

        this.setContentPane(new Container());
        this.getContentPane().add(BTN1);
        this.getContentPane().add(TXTFLD1);
        this.getContentPane().add(TXTFLD2);
    }
}

Por que o ouvinte de alteração de propriedade não está funcionando. Quais são as outras soluções alternativas para esse problema?

questionAnswers(6)

yourAnswerToTheQuestion