Java JButton Settings setAllEnabled(final ButtonGroup buttonGroup, final boolean enabled)

Here you can find the source of setAllEnabled(final ButtonGroup buttonGroup, final boolean enabled)

Description

Enables (or disables) all the buttons in a button group.

License

Creative Commons License

Parameter

Parameter Description
buttonGroup The button group.
enabled Whether the button should be enabled.

Declaration

public static void setAllEnabled(final ButtonGroup buttonGroup, final boolean enabled) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

import java.util.Collections;

import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;

public class Main {
    /**//ww w .j  ava 2  s  .  c  o m
    Enables (or disables) all the buttons in a button group.
        
    @param buttonGroup The button group.
    @param enabled Whether the button should be enabled.
    **/
    public static void setAllEnabled(final ButtonGroup buttonGroup, final boolean enabled) {
        for (final AbstractButton button : Collections.list(buttonGroup.getElements())) {
            button.setEnabled(enabled);
        }
    }
}

Related

  1. ScaleButtonIcon(JToggleButton btn, int width, int height, int fontsize)
  2. SelectedOptionButton(Container container)
  3. selectFile(final int openMode, final String title, final String buttonText, final String lastDirectoryUsed, final Component parent, final String suffix, final String description)
  4. selectWithoutNotifyingListeners(AbstractButton ab, boolean selected)
  5. setAction(AbstractButton btn, ActionListener listener, String actionCommand)
  6. setAutoMnemonic(AbstractButton button)
  7. setBtnValue(ButtonGroup group, String value)
  8. setButton(AbstractButton button, Icon icon, ActionListener buttonListener)
  9. setButtonContentMargin(AbstractButton button, Insets margin)