logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psm...@apache.org
Subject cvs commit: jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw ChainsawTabbledPane.java
Date Mon, 05 May 2003 03:11:00 GMT
psmith      2003/05/04 20:11:00

  Added:       src/java/org/apache/log4j/chainsaw ChainsawTabbledPane.java
  Log:
  Added new TabbedPane class, even though I wish I did not have to.
  
  Revision  Changes    Path
  1.1                  jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/ChainsawTabbledPane.java
  
  Index: ChainsawTabbledPane.java
  ===================================================================
  /*
   * @author Paul Smith <psmith@apache.org>
   *
  */
  package org.apache.log4j.chainsaw;
  
  import javax.swing.JComponent;
  import javax.swing.JTabbedPane;
  
  /**
   * 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!
   * 
   * @see http://developer.java.sun.com/developer/bugParade/bugs/4253819.html
   * @author Paul Smith <psmith@apache.org>
   *
   */
  class ChainsawTabbledPane extends JTabbedPane {
  
  
    /**
     * 
     */
    public ChainsawTabbledPane() {
      super();
    }
  
    /**
     * @param tabPlacement
     */
    public ChainsawTabbledPane(int tabPlacement) {
      super(tabPlacement);
    }
  
    /**
     * @param tabPlacement
     * @param tabLayoutPolicy
     */
    public ChainsawTabbledPane(int tabPlacement, int tabLayoutPolicy) {
      super(tabPlacement, tabLayoutPolicy);
    }
    
    /**
     * 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...
     * @param name
     * @param component
     */
    public void addANewTab(String name, JComponent component) {
      super.insertTab(name, null, component, null, 0);
      super.fireStateChanged();
    }
  
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org


Mime
View raw message