【问题标题】:Panel over a GridLayout PanelGridLayout 面板上的面板
【发布时间】:2013-10-12 21:57:18
【问题描述】:

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

【问题讨论】:

标签: java swing layout jpanel grid-layout


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-09-25
  • 2012-01-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多