0

The problem is:

I have 2 JTextFields, 1 is input field and 2 is output. What I want to do is when type somethink to 1 field, that text will be coppied and modified to field 2. The problem is I would preffer to make changes in second field, while editting. I can do it after button click or accept of change but I want to do it in real time. I can guess I should use somekind of property listener?

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Naix
  • 17
  • 6

1 Answers1

1

with this post you can do it with documentlistener

textField.getDocument().addDocumentListener(new DocumentListener() {
  public void changedUpdate(DocumentEvent e) {
    //do something
  }
  public void removeUpdate(DocumentEvent e) {
    //do something
  }
  public void insertUpdate(DocumentEvent e) {
   //do something
  }
});
Community
  • 1
  • 1
Ker p pag
  • 1,568
  • 12
  • 25