I have many JLabel
s (which includes ImageIcon
s) in a JPanel
.
And this JPanel
is only a panel on the GUI; there ar
Either
null
layout manager (myPanel.setLayout(null);
) and set component positions externally (Component.setBounds).Take a look at MigLayout, which allows you to do absolute positioning, it's not part of the JDK, but a seperate download.
It's very good as far as layout managers go and does absolute positioning, plus a whole load of other things.
See Doing Without a Layout Manager (Absolute Positioning) in the Java tutorials.
Creating a container without a layout manager involves the following steps.
- Set the container's layout manager to null by calling
setLayout(null)
.- Call the
Component
class'ssetbounds
method for each of the container's children.- Call the
Component
class'srepaint
method.