wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Not refreshing... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Not refreshing..." Watch "Not refreshing..." New topic
Author

Not refreshing...

Chris Stewart
Ranch Hand

Joined: Sep 14, 2002
Posts: 184
I'm basically trying to move cards left or right based on their starting location. I have some logic which selects two cards (JLabels) and passes them to this method. After each movement (setBounds()), I try and refresh to show their current position but it doesn't happen. Any ideas?
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Two suggestions... call validate() on the component that holds the card JLabels. And make sure that you are using setLayout( null ) on the parent component, otherwise setBounds() won't work.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Chris Stewart
Ranch Hand

Joined: Sep 14, 2002
Posts: 184
If I set the layout method to null, nothing shows up in my JFrame. I'm using setBounds all over the place in this and it works, I just can't get it to refresh after each loop.
I tried calling the validate method, but that didn't work either.
Here is my entire Layout class: (the moveCards method is at the very bottom)

[ July 05, 2003: Message edited by: Chris Stewart ]
Chris Stewart
Ranch Hand

Joined: Sep 14, 2002
Posts: 184
I fixed this problem, I just needed to put the movement into a thread of its own.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not refreshing...