Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
  • salvin francis
  • Frits Walraven
  • Piet Souris

Problem with JRadioButton

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,
I am developing one ExamSimulator. at a time one question and three options will display on a screen.
I have three JRadioButtons and i have added those three in one ButtonGroup so that at a time only one will get selected.Now while displaying next question i want all the options should be unchecked. how to achieve this?
i am using setSelected(false) method of JRadioButton. but i am not getting the expected result.
expecting your help
Ranch Hand
Posts: 15304
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that the way a JRadio Button works is one always has to be selected. I may be wrong, but in my experience with them, it seems that one radio button has to be the default answer. I would like to be proven wrong though.
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mihir,
Gregg's logic is correct. However, humans are easily fooled. The following code will perform what you want.

Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic