0

im new to java swing and im building an application which creates a resume based on user inputs and then displays the resumes created.

i have a label which ask the user whether theyre part of a STEM course or not. so i have two radio buttons which accomplish that task with names : 1.STEM 2.Non STEM

ive added them to a buttongroup so only one is selected.

public void groupButton(){
    bg1 = new ButtonGroup();
    bg1.add(stemRadioButton);
    bg1.add(nonStemRadioButton);
}

Each time i try to get the value of the radio button selected it keeps returning a null value.

Im new to this and i think it might have been answered and any help would be of great help ! thanks in advance !

EDIT :: i try retrieving the value by bg1.getSelected().getActionCommand; ive also tried using the getText method too.

  • 1
    *"Each time i try to get the value of the radio button selected it keeps returning a null value"*. How are you getting the value? Please post a [mcve] which demonstrates this issue. – Frakcool Sep 21 '16 at 16:20
  • 1
    If this is not a duplicate, please edit your question to include a [mcve] that shows your revised approach, as @Frakcool suggests. – trashgod Sep 21 '16 at 18:05

1 Answers1

0

getText() if you want to get name of radio button

GlacialMan
  • 579
  • 2
  • 5
  • 20