Hi, I am new to Java and just learning GUI's. I was wondering if someone could help me with a project? I am trying to create a questionnaire. It will was the user a question and have radio button answers. After the answer is selected, they will hit the "next" button and depending on the answer selected will direct them to a related follow up question with it's own answers. For example: Prompted a question - user selects answer A and hits "next" - because he selected A it would go to class2 with another question - answer. If the customer selected answer B instead - it would of gone to class3...and so fourth. I am familar with making radio buttons, I'm just not sure how to make it determine what class to go to based on the answer selected and hitting the "next" button.

Any help would greatly help me learn!

Thank you in advance!

Hi, I am new to Java and just learning GUI's. I was wondering if someone could help me with a project? I am trying to create a questionnaire. It will was the user a question and have radio button answers. After the answer is selected, they will hit the "next" button and depending on the answer selected will direct them to a related follow up question with it's own answers. For example: Prompted a question - user selects answer A and hits "next" - because he selected A it would go to class2 with another question - answer. If the customer selected answer B instead - it would of gone to class3...and so fourth. I am familar with making radio buttons, I'm just not sure how to make it determine what class to go to based on the answer selected and hitting the "next" button.

Any help would greatly help me learn!

Thank you in advance!

Did you attempt writing any code at all?

Add an ActionListener to the "next" button. In the listener you test each radio button to see if it's checked and, if it is, take the appropriate action (eg create a new instance of the appropriate class)
Now write some code...

Edited 5 Years Ago by JamesCherrill: n/a

Did you attempt writing any code at all?

I have only wrote simple radio button code to change a picture. I have began to write this out yet because I wasnt sure how to make it work the way I wanted it to.

This article has been dead for over six months. Start a new discussion instead.