是否可以在具有GridLayout
图像的面板上显示面板(例如Panel-A几乎透明)?
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
。