• Post Reply Bookmark Topic Watch Topic
  • New Topic

about JTextField input  RSS feed

 
Aron Jhed Amiscosa
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.

how can i make two different JTextFields get the same input at the same time?

i mean, as i type a string on the 1st text field, it will be also typed on the 2nd textfield.

is there a possibility to do this?

im thinking about that it has something to do with DocumentEvent and DocumentListener but i dont know where to start.

ideas are welcome.
 
Rob Spoor
Sheriff
Posts: 21050
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
textField2.setDocument(textField1.getDocument()). The Document for text components is like the model for lists, tables, trees, scroll bars etc.
 
Aron Jhed Amiscosa
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:textField2.setDocument(textField1.getDocument()). The Document for text components is like the model for lists, tables, trees, scroll bars etc.


i see. thanks mr rob.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!