Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

2 textfields 1 model  RSS feed

 
Ronnie Phelps
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to assign one model to two different text fields in order to have the same data in both text fields when text is entered. How would I go about doing this?
 
King Tan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTextField t1 = new JTextField("hello");
JTextField t2 = new JTextField();
t2.setDocument(t1.getDocument());
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!