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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2021-10-13
  • 2022-01-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案