嗨,我尝试使用 for 循环运行 JTabbedPanel。我的程序运行成功。但它没有像我预期的那样创建任何 Tab 文件。请帮我。
public void GenerateGUI() {
jPanel = new JPanel[3];
jSplitPane1 = new JSplitPane();
jTabbedPane1 = new JTabbedPane();
GroupLayout[] jPanelLayout = new GroupLayout[3];
for (int i = 0; i <= noOfTerminals; i++) {
jPanel[i] = new JPanel();
jPanelLayout[i] = new GroupLayout(jPanel[i]);
jPanel[i].setLayout(jPanelLayout[i]);
jPanelLayout[i].setHorizontalGroup(jPanelLayout[i]
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addGap(
0, 449, Short.MAX_VALUE));
jPanelLayout[i].setVerticalGroup(jPanelLayout[i]
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addGap(
0, 250, Short.MAX_VALUE));
jPanel[i].add(lblOverView);
jTabbedPane1.addTab("OverView", jPanel[i]);
}
setLayout(null);
add(jTabbedPane1);
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
pack();
setVisible(true);
setLocationRelativeTo(null);
}