Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Refresh JTextField (Swing)

843805Jan 5 2006 — edited Jan 9 2006
I'm developing software which will retrieve some information from a database, but I'd like to have a text field which will be display "Working" whilst the system is getting the data. The user will activate this part by selecting the table name from a JTree.

So, I've added the text field, set it's text, but when the user selects the table name from the JTree, the text field doesn't update. When the system's finished, and I set the text field to "Waiting" - that works ok.

Some example code (off the top of my head, as I'm not at work):
// Set the text in the text field.
lblStatus.setText("Waiting");

// Do something.

// Now get the info from the database.
lblStatus.setText("Working");     // This line not working!
fillTable();    // Call method to get data.
lblStatus.setText("Waiting");     // This line does work.
If I print to the bebug window at those points, it works fine - it's just the text field that isn't updated.

Any ideas?

Thanks,

Adrian Johnson

Windows XP Pro SP2, Java 1.5 update 5, NetBeans 4.1
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 6 2006
Added on Jan 5 2006
8 comments
458 views