How to pass radio button's value to another frame

i only know how to pass label and textfield value but not radiobutton.

is there anyway to take the value from radiobutton to another frame?


this is the code of mine how to pass label and textfield

public void actionPerformed(ActionEvent e){
				if((e.getSource() == jBook)) {

					String name = jlbName.getText ();
					String date = jlbDateProduce.getText ();
					int number = (Integer.parseInt(jtfNoOfTicket.getText().trim()));
					String price = jlbPrice.getText ();


					//Passing
					ticketReservation frame = new ticketReservation(name, date, price, String.valueOf(number));
   					frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
					frame.setTitle("Ticket Reservation"); //set title of the window
					frame.setSize(800,600); //size of the window
					frame.setVisible(true); //visible the window
					frame.setLocationRelativeTo (null); //center the window

			}
public ticketReservation (String name, String date, String price, String number) {

		setLayout(null); //set LayoutManager

    		// initialized the label
    		jlbName = new JLabel("Movie : " + name);
    		jlbDate = new JLabel(date);
    		jlbShowtime = new JLabel("Showtime :");
   			jlbNoOfSeats = new JLabel("No of Seats :");
    		jlbPrice = new JLabel(price);
    		jlbNoOfTicket = new JLabel("Number of Tickets : " +number);

Maybe I don't understand the question,
But if you get the value of the radio button (checked or not-checked)
and put it into a variable you could use that variable to display or check
in any JFrame.

Is that what you are asking, or am I missing something (like a brain :))?

- WolfShield

i meant i want to have the value of radio button to display on another frame...

sry for my english..

by using String

myRadio.setActionCommand("XXX"); // for ButtonGroup
String sel = myButtonGroup.getSelection().getActionCommand();

myRadio.isSelected//return boolean value

Do you mean that you want to pass the value of one radio button (boolean selected/not selected) OR do you want to pass info about which radio button was selected in a button group?
These are different options, that have different solutions.

ooo...i need to pass value of one radio button that selected...help me plss

Then use mKorbel's solution and pass the associated Action name as a String parameter

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.