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!

Recommended Answers

All 4 Replies

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...

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.