Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTextField not updated from dialog box.

 
chiranjeevi gunturu
Ranch Hand
Posts: 59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a panel on which it has a button and a text box,cost.On clicking on the button i will get a dialog box which is having the same text box,cost.it means both the text fields are refering to the same object,JTextField.

Now if i try to get the value entered on the text box on the dialog screen to the panel screen, the text field on the panel has become invisible. I am able to get the value in the action listner also.

Please help me out.
Thanks in advance,
chiranjeevi gunturu
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can add any child component to any parent only once.

Looks like you are trying to synch the two text fields.
You can achieve this desired behavior by creating two text fields, adding a document listener to one of them and updating the second text field using the document notifications.
 
Rob Spoor
Sheriff
Pie
Posts: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or giving them the same document:

[ November 11, 2008: Message edited by: Rob Prime ]
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Prime:
Or giving them the same document:


[ November 11, 2008: Message edited by: Rob Prime ]


Man,
I can't believe I missed out on this one.
Thanks Rob!
 
Rob Spoor
Sheriff
Pie
Posts: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stuff like that happens. Like how I missed out on two scroll bars sharing a model a few weeks ago.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic