Class ChainsawTabbedPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, SwingConstants, SettingsListener

class ChainsawTabbedPane extends JTabbedPane implements SettingsListener
The only reason this class is needed is because of a stupid 'issue' with the JTabbedPane.

If the currently selected tab is the first tab, and we insert a new tab at the front, then as far as the JTabbedPane is concerned, NO STATE has changed, as the currently selected tab index is still the same (even though the TAB is different - go figure) and therefore no ChangeEvent is generated and sent to listeners. Thanks very much Sun!

For more information on the issue: http://developer.java.sun.com/developer/bugParade/bugs/4253819.html

  • Field Details

  • Constructor Details

    • ChainsawTabbedPane

      public ChainsawTabbedPane()
      Create the tabbed pane.
  • Method Details

    • containsWelcomePanel

      boolean containsWelcomePanel()
      Returns true if this TabbedPane has an instance of the WelcomePanel in it
      Returns:
      true/false
    • addANewTab

      public void addANewTab(String name, JComponent component, Icon icon)
      Our custom implementation of inserting a new tab, this method ALWAYS inserts it at the front because we get an ArrayIndexOutOfBoundsException otherwise under some JDK implementations.

      This method also causes a fireStateChange() to be called so that listeners get notified of the event. See the class level comments for the reason why...

      Parameters:
      name -
      component -
    • setSelectedTab

      public void setSelectedTab(int index)
    • addANewTab

      public void addANewTab(String name, JComponent component, Icon icon, String tooltip)
    • remove

      public void remove(Component component)
      Overrides:
      remove in class JTabbedPane
    • saveSettings

      public void saveSettings(SaveSettingsEvent event)
      Saves the state of the currently active tabs to an XML file. Only considers the Welcome, Drag and Drop and chainsaw-log panels as they are the panel which are always running. Saves whether they are hidden or not....
      Specified by:
      saveSettings in interface SettingsListener
    • loadSettings

      public void loadSettings(LoadSettingsEvent event)
      Loads the saved tab setting by reading the XML file. If the file doesn't exist, all three panels should be shown as the default setting....
      Specified by:
      loadSettings in interface SettingsListener