Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

isSelected not recognizing which radiobutton is selected.  RSS feed

 
ryan conklin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My program needs to determine to rate to apply for the movie tickets based on the radiobuttons. No matter the radiobutton selected it always uses the senior rate, any ideas?

 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rogue semicolon on line 254!

I would avoid using Event.getSource: instead, add your event handling as inner classes that implement ActionListener.

 
Campbell Ritchie
Marshal
Posts: 55717
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and why on earth are you using an invisible button. Get rid of the invisible button, and set the Adult button to be chosen by default.

Moving to our GUIs forum, where this discussion would sit better.

Ad welcome to the Ranch
 
peter hammond
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am new but i do have a handy trick i use when i dont get the right answer when items are selected...

add in

System.out.println("Gets Here 1");

in each of your statements and increment the number at the end then that way when you hit the calculate button on the child you see in your code...

you get!

Gets Here 1
Gets Here 3

so you know that for somereason the listiners are accessing those to actions so you can trace back as to why they are also being selected...

 
ryan conklin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for pointing out the semicolon. Took it away and the program is running as desired. The hidden button was a part of the assignment to require data validations for all the input.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!