• Post Reply Bookmark Topic Watch Topic
  • New Topic

JRadioButton: actionPerformed problem  RSS feed

 
Juhan Voolaid
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I have a simple form, with several radiobuttons, textfields and a submit button. Action listener is only set to the button. So after I press the button, I print out the information, but I get strange exception. Please help.



And the output I see on console, after I press the "draw" button:

[ March 13, 2006: Message edited by: Juhan Voolaid ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception is telling you that you can't cast a JRadioButton to a ButtonModel. Not at all strange if you think about it...
 
Ben Zung
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You are casting a RadioButton to a ButtonModel. Instead why not use


Good luck.
 
Juhan Voolaid
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK ... now it seems obvious, but it was first time for me to deal with JRadioButton and I really got confused.

Thank you everybody.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!