use of javax.swing.plaf.ButtonUI in project jdk8u_jdk by JetBrains.
the class ScreenMenuItemCheckbox method addNotify.
public void addNotify() {
super.addNotify();
// Avoid the Auto toggle behavior of AWT CheckBoxMenuItem
CCheckboxMenuItem ccb = (CCheckboxMenuItem) getPeer();
ccb.setAutoToggle(false);
fMenuItem.addComponentListener(this);
fPropertyListener = new ScreenMenuPropertyListener(this);
fMenuItem.addPropertyChangeListener(fPropertyListener);
addActionListener(this);
addItemListener(this);
fMenuItem.addItemListener(this);
setIndeterminate(IndeterminateListener.isIndeterminate(fMenuItem));
// can't setState or setAccelerator or setIcon till we have a peer
setAccelerator(fMenuItem.getAccelerator());
final Icon icon = fMenuItem.getIcon();
if (icon != null) {
this.setIcon(icon);
}
final String tooltipText = fMenuItem.getToolTipText();
if (tooltipText != null) {
this.setToolTipText(tooltipText);
}
// sja fix is this needed?
fMenuItem.addItemListener(this);
final ButtonUI ui = fMenuItem.getUI();
if (ui instanceof ScreenMenuItemUI) {
((ScreenMenuItemUI) ui).updateListenersForScreenMenuItem();
}
if (fMenuItem instanceof JCheckBoxMenuItem) {
forceSetState(fMenuItem.isSelected());
} else {
forceSetState(fMenuItem.getModel().isSelected());
}
}
Aggregations