Re: JFrame disaperes after creation.
On May 16, 10:59 am, iMo...@live.se wrote:
You got some great responses already, but I just
thought I would comment on something else I noticed..
Hello guys. what am I doing wrong here ?? Im trying to create a
JFrame from a controler class with
View v = new view(this);
If this 'View' class is effectively 'just another
frame' of a multi-frame application, then..
setDefaultCloseOperation(EXIT_ON_CLOSE);
...is not the correct close action. The effect of
closing a View will be to end the application!
Try using DISPOSE_ON_CLOSE for the frames that are
'children', or perhaps the View is better suited to
being in a JDialog, or JOptionPane.
I am always a little suspect of 'multi-frame
applications' since I cannot recall seeing a
program that worked that way, that was not
better suited to some other form of presentation.
Such as..
- parent with JDialog, JOptionPanes or JWindows
for children.
- JDesktopPane with JInternalFrames
- CardLayout or JTabbedPane
- ...
--
Andrew T.
pscode.org