I have two transparent overlapping JPanel
both inside of a container panel, using CardLayout
.
I have components inside both panels, but even if they are both transparent, it is showing only the components inside the panel added for first inside the container:
panel1.setOpaque(false);
panel2.setOpaque(false);
container.setLayout(new CardLayout(0, 0));
container.add(panel1); //only components inside panel1 are shown
container.add(panel2); //if I change order, only components in panel2 are shown
Since I have buttons in panel1
and labels in panel2
(I need them to be like this), I would like to make both panels' components visible.