Java Code Examples for java.awt.Component#setEnabled()

The following examples show how to use java.awt.Component#setEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: frmToolChangeSettings.java    From sourcerabbit-gcode-sender with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates new form NewJDialog
 */
public frmToolChangeSettings(frmControl parent, boolean modal)
{
    super(parent, modal);
    initComponents();

    fMyMain = parent;

    // Set form in middle of frmControl
    Position2D pos = UITools.getPositionForDialogToOpenInMiddleOfParentForm(parent, this);
    this.setLocation((int) pos.getX(), (int) pos.getY());

    // Enable Settings if getEnableSemiAutoToolChange == true
    jCheckBoxEnableSemiAutoToolChange.setSelected(SemiAutoToolChangeSettings.isSemiAutoToolChangeEnabled());
    for (Component component : jPanel1.getComponents())
    {
        component.setEnabled(SemiAutoToolChangeSettings.isSemiAutoToolChangeEnabled());
    }

    jTextFieldToolSetterX.setText(String.valueOf(SemiAutoToolChangeSettings.getToolSetterX()));
    jTextFieldToolSetterY.setText(String.valueOf(SemiAutoToolChangeSettings.getToolSetterY()));

}
 
Example 2
Source File: CodingStandardsFixerCustomizerPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void setAllComponetsEnabled(boolean isEnabled) {
    Component[] components = getComponents();
    for (Component component : components) {
        if (component != enabledCheckBox) {
            component.setEnabled(isEnabled);
        }
    }
}
 
Example 3
Source File: ColorChooserPanel.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void setEnabled(Container container, boolean enabled) {
    for (Component component : container.getComponents()) {
        component.setEnabled(enabled);
        if (component instanceof Container) {
            setEnabled((Container) component, enabled);
        }
    }
}
 
Example 4
Source File: SeaGlassTabbedPaneUI.java    From seaglass with Apache License 2.0 5 votes vote down vote up
/**
 * Set the bounds Rectangle for a scroll button.
 *
 * @param child    the scroll button.
 * @param visible  whether the button is visible or not.
 * @param position the position from the start of the tab run.
 */
private void setScrollButtonPositions(Component child, boolean visible, int position) {
    if (visible) {
        child.setBounds(orientation.createBounds(position,
                                                 orientation.getOrthogonalOffset(rects[leadingTabIndex]),
                                                 orientation.getLength(child.getPreferredSize()),
                                                 orientation.getThickness(rects[leadingTabIndex])));
    }

    child.setEnabled(tabPane.isEnabled());
    child.setVisible(visible);
}
 
Example 5
Source File: IKTasksTableModel.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   IKTasksCell obj = (IKTasksCell)value;
   // Reset bg/fg colors before calling super.getTableCellRendererComponent()
   setBackground(null);
   setForeground(null);
   Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
   comp.setEnabled(obj.tasks.getEnabled(obj.index));
   // Override bg/fg colors for invalid entry
   if(obj.renderValidity() && !obj.tasks.isValid(obj.index)) {
      if(isSelected) comp.setForeground(invalidColor);
      else comp.setBackground(invalidColor);
   }
   return comp;
}
 
Example 6
Source File: Utils.java    From TrakEM2 with GNU General Public License v3.0 5 votes vote down vote up
/** Recursively enable/disable all components of the @param root Container. */
static public void setEnabled(final Container root, final boolean b) {
	final LinkedList<Container> cs = new LinkedList<Container>();
	cs.add(root);
	while (cs.size() > 0) {
		for (final Component c : cs.removeLast().getComponents()) {
			if (c instanceof Container) cs.add((Container)c);
			c.setEnabled(b);
		}
	}
}
 
Example 7
Source File: ReplacePanel.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
public void setEnabled(boolean enable) {
    super.setEnabled(enable);
    for (Component c : getComponents()) {
        c.setEnabled(enable);
    }
    updateValidation();

}
 
Example 8
Source File: NodeRenderer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Finds the component that is capable of drawing the cell in a tree.
 * @param value value can be either <code>Node</code>
 * or a <code>VisualizerNode</code>.
 * @return component to draw the value
 */
@Override
public Component getTreeCellRendererComponent(
    JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus
) {
    assertEDTAccess();
    VisualizerNode vis = findVisualizerNode(value);

    if (vis == draggedOver) {
        sel = true;
    }

    String text = vis.getHtmlDisplayName();
    boolean isHtml = text != null;

    if (!isHtml) {
        text = vis.getDisplayName();
    }

    //Get our result value - really it is ren, but this call causes
    //it to configure itself with the passed values
    Component result = renderer.getTreeCellRendererComponent(tree, text, sel, expanded, leaf, row, hasFocus);

    result.setEnabled(tree.isEnabled());
    renderer.setHtml(isHtml);

    //Do our additional configuration - set up the icon and possibly
    //do some hacks to make it look focused for TreeTableView
    configureFrom(renderer, tree, expanded, sel, vis);

    return result;
}
 
Example 9
Source File: AbstractSwingWidget.java    From atdl4j with MIT License 5 votes vote down vote up
public void setEnabled(boolean enabled)
{
	for ( Component control : getComponents() )
	{
		if (control != null) {
			control.setEnabled( enabled );
		}
	}
}
 
Example 10
Source File: ColorChooserPanel.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void setEnabled(Container container, boolean enabled) {
    for (Component component : container.getComponents()) {
        component.setEnabled(enabled);
        if (component instanceof Container) {
            setEnabled((Container) component, enabled);
        }
    }
}
 
Example 11
Source File: JScrollBar.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Enables the component so that the knob position can be changed.
 * When the disabled, the knob position cannot be changed.
 *
 * @param x a boolean value, where true enables the component and
 *          false disables it
 */
public void setEnabled(boolean x)  {
    super.setEnabled(x);
    Component[] children = getComponents();
    for (Component child : children) {
        child.setEnabled(x);
    }
}
 
Example 12
Source File: ColorChooserPanel.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private static void setEnabled(Container container, boolean enabled) {
    for (Component component : container.getComponents()) {
        component.setEnabled(enabled);
        if (component instanceof Container) {
            setEnabled((Container) component, enabled);
        }
    }
}
 
Example 13
Source File: ColorChooserPanel.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void setEnabled(Container container, boolean enabled) {
    for (Component component : container.getComponents()) {
        component.setEnabled(enabled);
        if (component instanceof Container) {
            setEnabled((Container) component, enabled);
        }
    }
}
 
Example 14
Source File: FormattingCustomizerPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void setEnabled(Component component, boolean enabled) {
    component.setEnabled(enabled);
    if (component instanceof Container && !(component instanceof JSpinner)) {
        for (Component c : ((Container)component).getComponents()) {
            setEnabled(c, enabled);
        }
    }
}
 
Example 15
Source File: ColorChooserPanel.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static void setEnabled(Container container, boolean enabled) {
    for (Component component : container.getComponents()) {
        component.setEnabled(enabled);
        if (component instanceof Container) {
            setEnabled((Container) component, enabled);
        }
    }
}
 
Example 16
Source File: FlagTest.java    From freecol with GNU General Public License v2.0 4 votes vote down vote up
private void enable(Component[] components, boolean value) {
    for (Component component : components) {
        component.setEnabled(value);
    }
}
 
Example 17
Source File: ActuatorsAndExternalLoadsPanel.java    From opensim-gui with Apache License 2.0 4 votes vote down vote up
private void setEnabled(JPanel panel, boolean enabled) {
   for(Component comp : panel.getComponents()) {
      comp.setEnabled(enabled);
      if(comp instanceof JPanel) setEnabled((JPanel)comp, enabled);
   }
}
 
Example 18
Source File: SamplerCPUSettings.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
public void setEnabled(boolean enabled) {
    super.setEnabled(enabled);
    for (Component c : getComponents())
        c.setEnabled(enabled);
}
 
Example 19
Source File: NodeRenderer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** This is the only method defined by <code>ListCellRenderer</code>.  We just
 * reconfigure the <code>Jlabel</code> each time we're called.
 */
@Override
public Component getListCellRendererComponent(
    JList list, Object value, int index, boolean sel, boolean cellHasFocus
) {
    assertEDTAccess();
    VisualizerNode vis = findVisualizerNode(value);

    if (vis == draggedOver) {
        sel = true;
    }

    String text = vis.getHtmlDisplayName();
    if (list.getModel() instanceof NodeListModel) {
        int depth = NodeListModel.findVisualizerDepth(list.getModel(), vis);
        if (depth == -1) {
            text = NbBundle.getMessage(NodeRenderer.class, "LBL_UP");
        }
    }
    boolean isHtml = text != null;
    if (!isHtml) {
        text = vis.getDisplayName();
    }

    //Get our result value - really it is ren, but this call causes
    //it to configure itself with the passed values
    Component result = renderer.getListCellRendererComponent(
            list, text, index, sel, cellHasFocus || (value == draggedOver)
        );
    renderer.setHtml(isHtml);
    result.setEnabled(list.isEnabled());

    //Do our additional configuration - set up the icon and possibly
    //do some hacks to make it look focused for TreeTableView
    int iconWidth = configureFrom(renderer, list, false, sel, vis);

    boolean bi = this.bigIcons || list instanceof ListPane;

    if (bi) {
        renderer.setCentered(true);
    } else {
        //Indent elements in a ListView/ChoiceView relative to their position
        //in the node tree.  Only does anything if you've subclassed and
        //overridden createModel().  Does anybody do that?
        if (list.getModel() instanceof NodeListModel && (((NodeListModel) list.getModel()).getDepth() > 1)) {
            int indent = iconWidth * NodeListModel.findVisualizerDepth(list.getModel(), vis);

            renderer.setIndent(indent);
        }
    }

    return result;
}
 
Example 20
Source File: SourceTab.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
public void enableFilters(boolean b) {
	Component[] components = filterPanel.getComponents();
	for (Component c : components) {
		c.setEnabled(b);
	}
}