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

Problem with painting a JTextField  RSS feed

 
Brian Drake
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all. I've a question regarding JTextFields (or any swing component, for that matter)
I need to refresh the contents of a JTextField from a separate thread running in my program. So the main thread of the program is off grinding on some long server process, and I want to update a little text field on the GUI with the current status.
I have a thread which seems to work fine: it obtains the new status, I can write it to the standard out, and it does successfully write the value to the text field. BUT, the text field does not refresh until the main thread is done with the big server process. I have used the paintImmediately() call on the text field to no avail.
Anyone have experience with this? All my testing indicates that the thread itself is running just fine. If I could just find a way to get that text field to paint itself when I want it to...
Thanks!
-BWD.
 
Brian Drake
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just as a followup, I solved the problem by passing in the frame and doing a paintImmediately() on the frame itself. I am still not sure why it didn't work just with the JTextField...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!