是否可以在一个具有GridLayout图像的面板上显示一个面板(例如Panel,它几乎是透明的)?
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。
发布于 2013-10-06 15:42:04
请参阅如何用JLayer类装饰组件
https://stackoverflow.com/questions/19206006
复制相似问题