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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Not refreshing..." Watch "Not refreshing..." New topic

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

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.

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...
Similar Threads
Urgent help PLEASE
Choosing a layout manager for card simulation
Help With 5 card stud program
commonPanel appear only in the last card with the CardLayout manager
Problem clearing and resetting a JPanel