Example usage for java.awt Component setEnabled

List of usage examples for java.awt Component setEnabled

Introduction

In this page you can find the example usage for java.awt Component setEnabled.

Prototype

public void setEnabled(boolean b) 

Source Link

Document

Enables or disables this component, depending on the value of the parameter b .

Usage

From source file:rita.ui.component.DialogSelectEnemies.java

private void enablePositionOptions(boolean enable) {
    if (!enable) {
        canSelectPosition = false;//from w ww  .jav  a 2 s . com
        for (Component comp : positionComponents) {
            comp.setEnabled(false);
        }
    } else {
        canSelectPosition = true;
        buttonPos.setEnabled(true);
        for (Component compPanel : panelSelectRobots.getComponents()) {
            JPanel parent = (JPanel) compPanel;
            // para cada panel la primer componente es el check y el segundo
            // es el boton
            JCheckBox check = (JCheckBox) parent.getComponent(0);
            if (check.isSelected()) {
                JButton button = (JButton) parent.getComponent(1);
                button.setEnabled(true);
            }
        }
    }
}

From source file:savant.view.dialog.LoadGenomeDialog.java

/**
 * Enable the appropriate controls depending on whether we're using a published
 * genome, or specifying by length./*  ww w  .jav  a 2s.  co  m*/
 */
private void updateEnabledControls() {
    boolean usingPublished = publishedGenomeRadio.isSelected();
    genomesCombo.setEnabled(usingPublished);
    for (Component c : auxiliaryPanel.getComponents()) {
        c.setEnabled(usingPublished);
    }
    lengthField.setEnabled(!usingPublished);
    nameField.setEnabled(!usingPublished);
}

From source file:sk.stuba.fiit.kvasnicka.topologyvisual.gui.components.TopologyPalette.java

/**
 * disables/enables all buttons in all categories
 *//* w ww .ja  v  a  2s.co m*/
public void setEnabledButtons(boolean enable) {
    for (JXTaskPane cat : categories.values()) {
        for (Component comp : cat.getComponents()) {
            if (comp instanceof JXCollapsiblePane) {
                for (Component c : ((JXCollapsiblePane) comp).getContentPane().getComponents()) {
                    if (c instanceof JToggleButton) {
                        c.setEnabled(enable);
                    }
                }
            }
        }

    }
}

From source file:ve.zoonosis.controller.modulos.novdedades.NuevoClienteController.java

private void activeInput(boolean b) {
    for (Component component : this.getComponents()) {
        if ((component instanceof JTextField) || (component instanceof JComboBox)) {
            component.setEnabled(b);
            if (component instanceof JTextField) {
                ((JTextField) component).setText(null);
            } else {
                ((JComboBox) component).setSelectedIndex(-1);
            }/*from ww  w  .  ja  v a2s.  co  m*/
        }
    }
}

From source file:ve.zoonosis.controller.seguridad.NuevoUsuarioController.java

private void activeInput(boolean b) {
    for (Component component : this.getComponents()) {
        if ((component instanceof JTextField) || (component instanceof JComboBox)
                || (component instanceof JDateChooser)) {
            component.setEnabled(b);
            if (component instanceof JTextField) {
                ((JTextField) component).setText(null);
            } else if (component instanceof JDateChooser) {
                ((JDateChooser) component).setDate(null);
            } else {
                ((JComboBox) component).setSelectedIndex(-1);
            }/*  w w w .  j ava  2 s  .co m*/
        }
    }
}