• Post Reply Bookmark Topic Watch Topic
  • New Topic

JRadiobutton  RSS feed

 
Narayanan Jayaraman
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I stop user from changing Radiobutton value ?. Is it possible to set the JRadiobutton enabled but still keep away user from changing it ?. Thanks .
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't that be confusing to the user, if the control looked like it was enabled, but she couldn't press it? Doesn't it make more sense to just disable it to prevent it from being pressed?
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you really need it, add ActionListener to JRadioButton, and in actionPerformed(), just negate its state.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!