CardLayout
1. CardLayout places components (usually panels) on top of each other in a stack like a deck of cards. You see only one at a time, and you can flip through the panels by using another control to select which panel comes to the top
2. CardLayout is a good layout to use when you have an area that contains different components at different times. This gives you a way to manage two or more panels that need to share the same display space.
3. CardLayout is usually associated with a controlling component, such as a check box or a list. The state of the controlling component determines which component the CardLayout displays. The user makes the choice by selecting something on the UI.
1. CardLayout places components (usually panels) on top of each other in a stack like a deck of cards. You see only one at a time, and you can flip through the panels by using another control to select which panel comes to the top
2. CardLayout is a good layout to use when you have an area that contains different components at different times. This gives you a way to manage two or more panels that need to share the same display space.
3. CardLayout is usually associated with a controlling component, such as a check box or a list. The state of the controlling component determines which component the CardLayout displays. The user makes the choice by selecting something on the UI.
1. CardLayout places components (usually panels) on top of each other in a stack like a deck of cards. You see only one at a time, and you can flip through the panels by using another control to select which panel comes to the top
2. CardLayout is a good layout to use when you have an area that contains different components at different times. This gives you a way to manage two or more panels that need to share the same display space.
3. CardLayout is usually associated with a controlling component, such as a check box or a list. The state of the controlling component determines which component the CardLayout displays. The user makes the choice by selecting something on the UI.
removeall()
add(..)但是我发现东西多了很乱
add(..)确实很烦的
我自己的项目中的做法是中间是一个JScrollPane各个面板的显示只要scrollPane.setViewportView(pane1)....
我们之前的做法也是removeall()和add()
但不知道用scrollPane.setViewportView(pane1)方法,当切换回之前的panel时,之前那个panel中的数据还存不存在,还是被重新初始化??
p.setVisible(false);//p.hide();试试看。
dd d=new dd(year,moth);
add(d)
写代码控制
d.setYear(..)
d.setMonth(..)
可放到paint方法中,或其他的操作方式
你能想到的