【发布时间】:2018-03-27 15:52:52
【问题描述】:
我想从按钮事件操作中显示另一个 jPanel。 例如
private void jButtonMouseClicked(MouseEvent e)
{
getContentPane().removeAll();
update(getGraphics());
//code to show another jPanel containing different sub-panels
}
【问题讨论】:
-
使用
CardLayout,看到这个example给你一个想法 -
我可以在
AbsoluteLayout中做些什么? @Frakcool -
不要使用它。
AbsoluteLayout=null layout= Null layout is evil 和 frowned upon to use them... 这是 example 使用它们时会发生什么... -
好的,感谢您的帮助!
-
当我使用
CardLayout时,我一次只能使用一个面板,有没有办法在一帧中添加多个面板,然后在事件切换到另一组同一框架内的多个面板? @Frakcool