Search in sources :

Example 21 with EventListenerList

use of javax.swing.event.EventListenerList in project java-swing-tips by aterai.

the class CloseableTabbedPaneUI method updateUI.

// /**
// * The normal closeicon.
// */
// private Icon normalCloseIcon;
// 
// /**
// * The closeicon when the mouse is over.
// */
// private Icon hooverCloseIcon;
// 
// /**
// * The closeicon when the mouse is pressed.
// */
// private Icon pressedCloseIcon;
// 
// /**
// * Creates a new instance of <code>CloseableTabbedPane</code>.
// */
// public CloseableTabbedPane() {
// super();
// init(SwingConstants.LEFT);
// }
// 
// /**
// * Creates a new instance of <code>CloseableTabbedPane</code>.
// * @param horizTextPosition  the horizontal position of the text (e.g.
// * SwingConstants.TRAILING or SwingConstants.LEFT)
// */
// public CloseableTabbedPane(int horizTextPosition) {
// super();
// init(horizTextPosition);
// }
@Override
public void updateUI() {
    removeMouseListener(handler);
    removeMouseMotionListener(handler);
    super.updateUI();
    eventListenerList = new EventListenerList();
    handler = new CloseableTabIconHandler();
    addMouseListener(handler);
    addMouseMotionListener(handler);
    if (getUI() instanceof WindowsTabbedPaneUI) {
        setUI(new CloseableWindowsTabbedPaneUI());
    } else {
        setUI(new CloseableTabbedPaneUI());
    }
}
Also used : EventListenerList(javax.swing.event.EventListenerList) WindowsTabbedPaneUI(com.sun.java.swing.plaf.windows.WindowsTabbedPaneUI)

Aggregations

EventListenerList (javax.swing.event.EventListenerList)21 Paint (java.awt.Paint)2 RectangleConstraint (org.jfree.chart.block.RectangleConstraint)2 WindowsTabbedPaneUI (com.sun.java.swing.plaf.windows.WindowsTabbedPaneUI)1 RenderingHints (java.awt.RenderingHints)1 PropertyChangeSupport (java.beans.PropertyChangeSupport)1 VetoableChangeSupport (java.beans.VetoableChangeSupport)1 ArrayList (java.util.ArrayList)1 LegendTitle (org.jfree.chart.title.LegendTitle)1 TextTitle (org.jfree.chart.title.TextTitle)1 Title (org.jfree.chart.title.Title)1