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());
}
}
Aggregations