Example usage for javax.swing AbstractButton isEnabled

List of usage examples for javax.swing AbstractButton isEnabled

Introduction

In this page you can find the example usage for javax.swing AbstractButton isEnabled.

Prototype

public boolean isEnabled() 

Source Link

Document

Determines whether this component is enabled.

Usage

From source file:com.projity.menu.MenuManager.java

public boolean isActionEnabled(String id) {
    Collection buttons = toolBarFactory.getButtonsFromId(id);
    if (buttons != null) {
        Iterator i = buttons.iterator();
        while (i.hasNext()) {
            AbstractButton button = (AbstractButton) i.next();
            return button.isEnabled();
        }//from  w w w .  j  av  a 2  s  .  c o  m
    } else {
        JMenuItem menuItem = menuFactory.getMenuItemFromId(id);
        if (menuItem != null)
            return menuItem.isEnabled();

    }
    return false;
}

From source file:org.pentaho.ui.xul.swing.tags.SwingButton.java

public void setDisabled(boolean dis) {
    final AbstractButton button = getButton();
    boolean previous = !button.isEnabled();
    button.setEnabled(!dis);//from  w w  w . j  av  a 2 s  .c om
    this.changeSupport.firePropertyChange("disabled", previous, dis);
}

From source file:org.pentaho.ui.xul.swing.tags.SwingButton.java

@Override
public void layout() {
    // check type to see if it's a toggleButton
    if (type == Type.CHECKBOX || type == Type.RADIO) {
        final AbstractButton oldButton = getButton();

        final AbstractButton button = new JToggleButton();
        button.setText(oldButton.getText());
        button.setIcon(oldButton.getIcon());
        button.setEnabled(oldButton.isEnabled());
        button.setSelected(this.selected);
        setButton(button);/*from  w w  w . ja v a  2 s  .  c  om*/

        if (this.getOnclick() != null) {
            this.setOnclick(this.getOnclick());
        }
    }
    final AbstractButton button = getButton();
    // adjust orientation of label and icon
    if (this.orientation == Orient.VERTICAL) {
        button.setHorizontalTextPosition(JButton.CENTER);
        if (this.dir == Direction.FORWARD) {
            button.setVerticalTextPosition(JButton.BOTTOM);
        } else {
            button.setVerticalTextPosition(JButton.TOP);
        }
    } else {
        button.setVerticalTextPosition(JButton.CENTER);
        if (this.dir == Direction.FORWARD) {
            button.setHorizontalTextPosition(JButton.RIGHT);
        } else {
            button.setHorizontalTextPosition(JButton.LEFT);
        }
    }

    // Square button patch. if no label and icon is square, set min/max to square up button
    final Icon icon = button.getIcon();
    if ("".equals(button.getText()) && icon != null && icon.getIconHeight() == icon.getIconWidth()) {
        Dimension dim = button.getPreferredSize();
        button.setMinimumSize(new Dimension(dim.height, dim.height));
        button.setPreferredSize(new Dimension(dim.height, dim.height));
    }

    button.setToolTipText(this.getTooltiptext());

    super.layout();
}