Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing state of a radio button at runtime in java

Status
Not open for further replies.

sudeepta

Programmer
Oct 31, 2002
6
IN
Hi,

Can anyone help me sort out this problem.

I have a form in java which has few fields and a radio button. Now after entering some values in a field and checking the radio button for something, i now press cancel so that all data entered in the fields is clear and also the state of radio button is changed to default.


My question therefore is how can we change a state of a radiobutton in java at runtime.

Thanks in advance.
Sudeep
 
Hi sudeepta,
To select or deselect a JCheckBox, use
Code:
setSelected (boolean)
. This will not through an event, however, so if you require to change states and through an event, use
Code:
doClick ()
.

Hope this Helps,
MarsChelios
 
Hi Mars,

Thanks for your help...
but what if I do not use swing.

Sudeep
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top