1

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

4

1 回答 1

2

请参阅如何使用 JLayer 类装饰组件

于 2013-10-06T15:42:04.097 回答