I have a JLayeredPane. My program works something like this:
JPanel p1 = new JPanel(new BoxLayout(p1, BoxLayout.X_AXIS));
JPanel p2 = new JPanel(new BoxLayout(p2, BoxLayout.Y_AXIS));
JLayeredPane lp = new JLayeredPane();
lp.add(p1, 1);
lp.add(p2, 0);
Both p1 and p2 have components like buttons, etc...
The issue is that when I add both JPanels to the JLayeredPane, NOTHING appears.
I tried changing the layout of the JLayeredPane().
For example, I did:
lp.setLayout(new BoxLayout(lp, BoxLayout.X_AXIS));
Then, the JPanels do show, but they are shown adjacent, not respecting the layers of the JLayeredPane.
Am I forced to use a null layout?
How can I make my JLayeredPane respect the layers and show my two BoxLayout JPanels correctly?
When I give my JLayeredPane a layout, it shows the panels, but it is not respecting the layers at all.