close Jframe from code

P

palmis

How can I close JFrame from code?
In my application If I select one JRadioBox, I want to close another
JFrame as if I click on the high-rigth button X.

How can I do?
Thanks
palmis
 
O

Oliver Wong

palmis said:
How can I close JFrame from code?
In my application If I select one JRadioBox, I want to close another
JFrame as if I click on the high-rigth button X.

How can I do?

You can call setVisible(false) on it, or you can call dispose() on it.
From the user's perspective, the window just disappears. But they have
different semantics from the programmer's side, so read the Javadocs for
both methods and see which one you want to use.

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,278
Latest member
BuzzDefenderpro

Latest Threads

Top