I'm working on a piece of code where several imageIcons will overlap several other imageIcons. imageIcons in the foreground will stay the same while imageIcons in the background will change to different imageIcons
I don't usually have the best luck with layouts. Components will move when I adjust the frame size, for instance. Also, when I add one object and then add another object, the second object will "push" the other object right (or wherever the particular layout is designed to put the next component.
Oracle's website stresses the importance to use a layout manager whenever possible (for sizing/resizing reasons). Would this be one of those cases where I would use Aboslute Positioning over the GridBag layout?
If a container holds components whose size is not affected by the container's size or by font, look-and-feel, or language changes, then absolute positioning might make sense.Although it is possible to do without a layout manager, you should use a layout manager if at all possible. A layout manager makes it easier to adjust to look-and-feel-dependent component appearances, to different font sizes, to a container's changing size, and to different locales.[According to Oracle.com]
Look at this link, may be this can help you.
http://www.leepoint.net/notes-java/GUI/layouts/60gridbaglayout.html