Package javax.swing

Examples of javax.swing.ButtonModel


        }

        public static Component createInputButtonComponent(final Object model,
                final AttributeSet attrs) {

            ButtonModel buttonModel = (ButtonModel) model;
            final JButton button = new JButton("");

            // Model
            if (buttonModel == null) {
                buttonModel = new FormButtonModel(new Form(SimpleAttributeSet.EMPTY),
View Full Code Here


        }

        public static Component createInputResetComponent(final Object model,
                                                     final AttributeSet attrs,
                                                     final FormView view) {
            ButtonModel resetButtonModel = (ButtonModel) model;
            final JButton resetButton = new JButton();

            // Model
            if (resetButtonModel == null) {
                resetButtonModel = new FormButtonModel(new Form(SimpleAttributeSet.EMPTY),
View Full Code Here

        }

        public static Component createInputSubmitComponent(final Object model,
                                                       final AttributeSet attrs,
                                                       final FormView view) {
            ButtonModel submitButtonModel = (ButtonModel) model;
            final JButton submitButton = new JButton();

            // Model
            if (submitButtonModel == null) {
                submitButtonModel = new FormButtonModel(new Form(SimpleAttributeSet.EMPTY),
View Full Code Here

        private static Component createImageComponent(final Object model,
                                                      final AttributeSet attrs,
                                                      final FormView view) {

            ButtonModel imageModel = (ButtonModel) model;
            final JButton image = new JButton("");

            // Model
            if (imageModel == null) {
                imageModel = new FormButtonModel(new Form(SimpleAttributeSet.EMPTY),
View Full Code Here

        }
        previousPressTime = event.getWhen();
    }

    public void mouseExited(final MouseEvent event) {
        final ButtonModel model = button.getModel();
        if (model.isEnabled()) {
            if (button.isRolloverEnabled()) {
                model.setRollover(false);
            }
            model.setArmed(false);
        }
    }
View Full Code Here

            model.setArmed(false);
        }
    }

    public void mouseEntered(final MouseEvent event) {
        final ButtonModel model = button.getModel();
        if (button.isRolloverEnabled()) {
            model.setRollover(true);
        }
        if (model.isEnabled() && model.isPressed()) {
            model.setArmed(true);
        }
    }
View Full Code Here

    protected void checkOpacity(final AbstractButton button) {
    }

    public void focusLost(final FocusEvent event) {
        if (button.isEnabled()) {
            final ButtonModel model = button.getModel();
            if (model.isEnabled()) {
                model.setArmed(false);
                model.setPressed(false);
            }
            button.repaint();
        }
    }
View Full Code Here

public class BasicButtonListener implements MouseListener, MouseMotionListener, FocusListener, ChangeListener, PropertyChangeListener {

    private static final class PressButtonAction extends AbstractAction {
        public static void press(final AbstractButton button) {
            if (button.isEnabled()) {
                final ButtonModel model = button.getModel();
                model.setArmed(true);
                model.setPressed(true);
                button.requestFocusInWindow();
            }
        }
View Full Code Here

    };

    private static final class ReleaseButtonAction extends AbstractAction {
        public static void release(final AbstractButton button) {
            if (button.isEnabled()) {
                final ButtonModel model = button.getModel();
                model.setPressed(false);
                model.setArmed(false);
            }
        }
View Full Code Here

     * @return Icon or null if there is no icon for the button.
     */
    public static Icon getCurrentIcon(final AbstractButton button) {
        Icon icon = null;

        final ButtonModel model = button.getModel();
        if (model.isEnabled()) {
            if (model.isArmed()) {
                icon = button.getPressedIcon();
            } else if (model.isRollover()){
                icon = model.isSelected() ? button.getRolloverSelectedIcon()
                        : button.getRolloverIcon();
            } else if (model.isSelected()) {
                icon = button.getSelectedIcon();
            }
        } else {
            icon = model.isSelected() ? button.getDisabledSelectedIcon()
                    : button.getDisabledIcon();
        }
        if (icon == null) {
            icon = button.getIcon();
        }
View Full Code Here

TOP

Related Classes of javax.swing.ButtonModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.