Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JRadio

 
qhyang
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I am having this kind of problem. Suppose I have a group of 5 radio buttons, each radion button associate with a text. When I select one radio button, I would like to get the associated text with this radio button.
Any help would be appreciated. Thanks!
qhyang
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi qhyang,
If you want the text displayed by the JRadioButton
the method is implemented in its parent class AbstractButton:

So you would call that method something like this:

Hope this helps,
Michael Morris
SCJP
 
qhyang
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works well.
Michael, Thanks a lot!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic