JavaRanch » Java Forums »
Java »
Swing / AWT / SWT
| 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.
|
 |
 |
|
|
subject: Not refreshing...
|
|
|
|