| Author |
Screen moves on its own
|
Danie Van Eeden
Greenhorn
Joined: Sep 03, 2003
Posts: 13
|
|
Hi, sorry for this if it sounds easy & stupid but here goes: Ive got a Jframe with GRidbaglayout as Layoutmanager. On this frame (on row 1) I have 9 columns which each contain another frame with a graphic. Ok underneath this (row 2) I have a blank label. Underneath this (row 3) I have another big panel (also containing gridbaglayout). On this gridbaglayout I have 6 more graphics (3x3). graphic on top panel further known as G1 graphics on bottom panel further known as G2 What i need to do is click on G1 (top panel) and then replace G2 (bottom panel) with this G1. I do this by firt removing both G1 and G2. toppanel.remove(g1) bottompanel.remove(g2) I then add g1 to the place where g2 was on the bottom panel. Thing is: It doesn't show up until I actually resize the form (even if I just drag it one pixel in any direction). If I manually resize it in coding: (setsize), then it works, but the whole main frame suddenly jumps about 10% bigger than it was. I dont want this. any help would be very greatly appreciated. (if you want my coding, just lemme know, cause I dont know if my expanation is sufficient). thanks all
|
Regards<br />-dve83-
|
 |
David Weitzman
Ranch Hand
Joined: Jul 27, 2001
Posts: 1365
|
|
|
After a series of container.add() or remove() calls, you should call validate() to have to container run its layout manager.
|
 |
Danie Van Eeden
Greenhorn
Joined: Sep 03, 2003
Posts: 13
|
|
|
thanks will keep that in mind for future use!
|
 |
Ryan Smith
Ranch Hand
Joined: Jun 29, 2004
Posts: 40
|
|
|
Also, try repaint();
|
 |
 |
|
|
subject: Screen moves on its own
|
|
|