Java JButton Settings getSelectedButton(ButtonGroup group)

Here you can find the source of getSelectedButton(ButtonGroup group)

Description

get Selected Button

License

Open Source License

Declaration

public static AbstractButton getSelectedButton(ButtonGroup group) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Enumeration;

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

public class Main {
    public static AbstractButton getSelectedButton(ButtonGroup group) {
        Enumeration<AbstractButton> buttons = group.getElements();
        while (buttons.hasMoreElements()) {
            AbstractButton button = buttons.nextElement();
            if (button.isSelected()) {
                return button;
            }/*from w  w  w  .  ja  v a 2 s  . c  om*/
        }
        return null;
    }
}

Related

  1. getMonospaceButton(final String text, final int size)
  2. getPreferredButtonSize(AbstractButton b, int textIconGap)
  3. getPreferredButtonSize(AbstractButton b, int textIconGap)
  4. getPressedButtonIcon(int x, int y)
  5. getRadioButtonBorder(int fontSize, boolean ltr)
  6. getSelectedButtonText(ButtonGroup buttonGroup)
  7. getSelectedButtonText(ButtonGroup buttonGroup)
  8. getSoftToggleButton(String string)
  9. getTextXOffset(AbstractButton c)