e830. 向JTabbedPane中加入一个卡片

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);
Related Examples
上一篇:Java MyBatis 插入数据库返回主键--insertSelective这样就不用每次到数据库里面查询了


下一篇:HDU 4946 凸包