Search in sources :

Example 6 with ButtonUI

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());
    }
}
Also used : ButtonUI(javax.swing.plaf.ButtonUI)

Aggregations

ButtonUI (javax.swing.plaf.ButtonUI)6 BasicRadioButtonUI (javax.swing.plaf.basic.BasicRadioButtonUI)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 DarculaButtonPainter (com.intellij.ide.ui.laf.darcula.ui.DarculaButtonPainter)1 DarculaButtonUI (com.intellij.ide.ui.laf.darcula.ui.DarculaButtonUI)1 Ref (com.intellij.openapi.util.Ref)1 JBColor (com.intellij.ui.JBColor)1 HorizontalLayout (com.intellij.ui.components.panels.HorizontalLayout)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 IOException (java.io.IOException)1 Border (javax.swing.border.Border)1 EmptyBorder (javax.swing.border.EmptyBorder)1 LineBorder (javax.swing.border.LineBorder)1 ColorUIResource (javax.swing.plaf.ColorUIResource)1 MetalButtonUI (javax.swing.plaf.metal.MetalButtonUI)1 Nullable (org.jetbrains.annotations.Nullable)1