更新时间:2023-12-05 23:20:40
I am trying to create a gui app using JTabbedPane to create 5 tabs. Each tab contains a panel with 3 panels in it
正如Swing组件的性质一样,除了JFrame
之外,您还可以将一个JComponent
嵌入另一个内.
因此,您需要做的是创建一个JPanel
.确保它具有3个列和1行的GridLayout
(或者,如果需要,反之亦然).
然后,将三个JPanels
添加到具有网格布局的此基本JPanel中.
As is the nature of Swing components, you can embed one JComponent
inside another except for JFrame
.
So, what you need to do is to create a JPanel
. Make sure it has a GridLayout
for 3 cols and 1 row (or the other way around, if that is your need).
Then, add the three JPanels
to this base JPanel which has grid layout.
最后,将基本JPanel
添加到您的JTabbedPane
中.看一下JPanel
教程: http://docs.oracle .com/javase/tutorial/uiswing/components/tabbedpane.html
Finally, add the base JPanel
to your JTabbedPane
. Have a look at the JPanel
tutorial: http://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html