ButtonGroupUtils

public class ButtonGroupUtils

Utilities for working with button groups. See https://stackoverflow.com/questions/201287/how-do-i-get-which-jradiobutton-is-selected-from-a-buttongroup#13232816

Author:Kyle M. Douglass

Methods

getSelectedButtonText

public static String getSelectedButtonText(ButtonGroup buttonGroup)

Determines the label of the current selected button.

Parameters:
  • buttonGroup
Returns:

The text label of the selected button.

selectButtonModelFromText

public static void selectButtonModelFromText(ButtonGroup buttonGroup, String text)

Selects the button in a button group based on its text label.

Parameters:
  • buttonGroup
  • text – The text label of the desired button to select.