You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ps...@apache.org on 2003/05/05 05:11:00 UTC
cvs commit: jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw ChainsawTabbledPane.java
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 <ps...@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 <ps...@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