PDA

View Full Version : [SOLVED] Java Form Help



shadhin
August 28th, 2012, 05:29 AM
I have two jFrames one is called MainMenu and the other is called SubMenu
i want to open the SubMenu jFrame from a button which is located in MainMenu and if i close SubMenu i need MainMenu still exist.

How can i do this by java at NetBeans?

prismctg
August 28th, 2012, 01:31 PM
No reply from anyone !!! I m also facing the problem :mad:

PaulM1985
August 28th, 2012, 01:55 PM
This is likely to be something that is setting the default close operation for your JFrames. There is a function called setDefaultCloseOperation and something is probably calling it passing in the parameter EXIT_ON_CLOSE. For your main window you probably want EXIT_ON_CLOSE and the child window will probably want either HIDE_ON_CLOSE or DISPOSE_ON_CLOSE.

See the Java API for more details.
http://docs.oracle.com/javase/6/docs/api/javax/swing/JFrame.html#setDefaultCloseOperation(int)

Paul

ofnuts
August 28th, 2012, 03:54 PM
No reply from anyone !!! I m also facing the problem :mad:Same homework?

shadhin
August 28th, 2012, 09:29 PM
Thank you "PaulM1985" for reply.

Easy way:
just go to Form properties and change the value of defaultCloseOperation as Dispose.


:guitar:

prismctg
August 29th, 2012, 10:51 AM
Same homework?
of course :D