是否可以在具有图像的面板上显示面板(例如几乎透明的面板 A)GridLayout?
JPanel mainPanel = new JPanel(new BorderLayout());
JPanel gridOfImages = new JPanel(new GridLayout(3,3));//Panel with a grid of images
JPanel nearlyOpaquePanel = new JPanel(); //A panel that is almost transparent.
// assuming that all already have the required properties like size and colour.
mainPanel.add(gridOfImages,Borderlayout.CENTER);
mainPanel.add(nearlyOpaquePanel,BorderLayout.CENTER);
我对这个想法的想法是面板将堆叠在一起,并且gridOfImages将通过 显示nearlyOpaquePanel,但我的结果是我只nearlyOpaquePanel显示了,我看不到gridOfImages它。