e830. adding a tab to a jtabbedpane container.txt
来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 25 行
TXT
25 行
This example demonstrates various ways to add a tab to a tabbed pane.
// Create a tabbed pane
JTabbedPane pane = new JTabbedPane();
// Add a tab with a label taken from the name of the component
component1.setName("Tab Label");
pane.add(component1);
// Add a tab with a label at the end of all tabs
String label = "Tab Label";
pane.addTab(label, component2);
// Add a tab with a label and icon at the end of all tabs
Icon icon = new ImageIcon("icon.gif");
pane.addTab(label, icon, component3);
// Add a tab with a label, icon, and tool tip at the end of all tabs
String tooltip = "Tool Tip Text";
pane.addTab(label, icon, component4, tooltip);
// Insert a tab after the first tab
int index = 1;
pane.insertTab(label, icon, component5, tooltip, index);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?