hi everyone, how to design an MDI in Jfram? I am having a problem that when I close a window the main application closes.
I have designed a jframe having three jbuttons so I want to achieve a functionality that when I will click a button a new fram should be opened on that existing one and when I will close it ( whether by clicking the close jButton or [X] on the fram) that window should be closed not the whole app.
When you click on a button and show a new window you should probably be using a JDialog and not a JFrame. If you want to stop the user accessing the JFrame whilst the JDialog is displayed you can can make the JDialog modal.
from the link you've already clicked on, scroll back up the page to the methods summary,
in particular methods inherited from window (there you'll find a method starting with 'd').
I agree with earlier posts - a second JFrame is extremely rare, except in a bad program.
as well as JDialog, JInternalFrame, you could even have your frame set as a CardLayout,
which gives you the option of switching between pages.
subject: How to close a window without closing the whole application