e835. 使JTabbedPane中的卡片生效和失效

By default, all new tabs are enabled, which means the user can select them. A tab can be disabled to prevent the user from selecting it.

    // Create a tabbed pane
JTabbedPane pane = new JTabbedPane(); // Add a tab
pane.addTab("Tab Label", component); // Get index of the new tab
int index = pane.getTabCount()-1; // Determine whether the tab is enabled
boolean enabled = pane.isEnabledAt(index); // Disable the tab
pane.setEnabledAt(index, false);
Related Examples
上一篇:关于微软C#中的CHART图表控件的简单使用


下一篇:e832. 从JTabbedPane中移动卡片