i want to select one of the radiobuttons from a radiobutton group and then on clickin the submit button it should take me to a diffrent frame.it should happen with either of the radiobuttons.how should i do it.....
please give some suggestions...
assuming the 2 radioButtons have different options on the 2nd frame,
all you do is the same as creating your initial frame:
note: a 2nd JFrame is generally a poor choice. JDialog is better suited
Joined: Apr 05, 2010
that's fine...but i need to put some conditions on the selection of the radiobuttons.if the user selects a radiobutton and then clicks on submit then it should lead him to a new frame containing different components.similarly if the user chooses different radiobutton and then submit.. it should lead him to a different frame.
can i give some conditions in the actionlistener method of the submit button ragarding the radiobuttons?
Joined: Jun 09, 2003
one way would be to have 2 panels option1 and option2
add their respective components to both
add them to the 2nd frame as a CardLayout
now, when submit is clicked, you show the cardLayout panel
as determined by which radioButton is selected
i.e. if rb1 is selected, show option1
if rb2 is selected, show option2