< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/synth/SynthButtonUI.java

Print this page




 125         SynthContext context = getContext(b, ENABLED);
 126 
 127         style.uninstallDefaults(context);
 128         context.dispose();
 129         style = null;
 130     }
 131 
 132     /**
 133      * {@inheritDoc}
 134      */
 135     @Override
 136     public SynthContext getContext(JComponent c) {
 137         return getContext(c, getComponentState(c));
 138     }
 139 
 140     SynthContext getContext(JComponent c, int state) {
 141         return SynthContext.getContext(c, style, state);
 142     }
 143 
 144     /**
 145      * Returns the current state of the passed in <code>AbstractButton</code>.
 146      */
 147     private int getComponentState(JComponent c) {
 148         int state = ENABLED;
 149 
 150         if (!c.isEnabled()) {
 151             state = DISABLED;
 152         }
 153         if (SynthLookAndFeel.getSelectedUI() == this) {
 154             return SynthLookAndFeel.getSelectedUIState() | SynthConstants.ENABLED;
 155         }
 156         AbstractButton button = (AbstractButton) c;
 157         ButtonModel model = button.getModel();
 158 
 159         if (model.isPressed()) {
 160             if (model.isArmed()) {
 161                 state = PRESSED;
 162             }
 163             else {
 164                 state = MOUSE_OVER;
 165             }




 125         SynthContext context = getContext(b, ENABLED);
 126 
 127         style.uninstallDefaults(context);
 128         context.dispose();
 129         style = null;
 130     }
 131 
 132     /**
 133      * {@inheritDoc}
 134      */
 135     @Override
 136     public SynthContext getContext(JComponent c) {
 137         return getContext(c, getComponentState(c));
 138     }
 139 
 140     SynthContext getContext(JComponent c, int state) {
 141         return SynthContext.getContext(c, style, state);
 142     }
 143 
 144     /**
 145      * Returns the current state of the passed in {@code AbstractButton}.
 146      */
 147     private int getComponentState(JComponent c) {
 148         int state = ENABLED;
 149 
 150         if (!c.isEnabled()) {
 151             state = DISABLED;
 152         }
 153         if (SynthLookAndFeel.getSelectedUI() == this) {
 154             return SynthLookAndFeel.getSelectedUIState() | SynthConstants.ENABLED;
 155         }
 156         AbstractButton button = (AbstractButton) c;
 157         ButtonModel model = button.getModel();
 158 
 159         if (model.isPressed()) {
 160             if (model.isArmed()) {
 161                 state = PRESSED;
 162             }
 163             else {
 164                 state = MOUSE_OVER;
 165             }


< prev index next >