Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes Auto Refresh Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Auto Refresh" Watch "Auto Refresh" New topic
Author

Auto Refresh

Mathews P Srampikal
Ranch Hand

Joined: Nov 26, 2002
Posts: 211
I have a JTextField.When application starts its text is 20.But depending on the database changes it has to refresh to 10 or 50.How to repaint this JTextField.


Thanks,
Mathews
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Are you talking about the width of the textfield or the text in the textfield? You shouldn't have to repaint the textfield to change the text, just call setText( String text ). If you need to change the width call setColumns( int columns ). Depending on the layout of the container holding the textfield, you may have to call invalidate() or validate() on the container to get it to resize correctly. Also, these methods should be called from the event thread... if you're calling them from another thread they aren't guaranteed to update automatically.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Auto Refresh
 
Similar Threads
How do I redirect to "login.jsp" after 5 seconds?
Upload attachment to QC [Quality Center] using java
How can I control Eclipse Refresh ?
JARS are visible threrough RAD 7.0
stats from Paul's site