tags:

views:

372

answers:

2

link between two JFrame using JMenu i have an application where i have to move to another frame by clicking a menu. for example, on a file menu, i click on add which will bring out a new frame where operations can be carried out. what code(s) can i use in Netbeans?

i used it to open another jframe but when i exit the new jframe both frames are closed .... there is something wrong in ma code plz help me in that prob.... thnxx

+1  A: 

You have to set the defaultCloseOperation to something else then EXIT_ON_CLOSE. Please refer to the documentation for JFrame for more information. I suspect that the second JFrame should only have HIDE_ON_CLOSE though.

willcodejavaforfood
+1  A: 

do you need to use jframes? why not jdialogs? (the dialog window (which can pop up) does not have to be modal.

if you have two different frames, that can make parentage (which window belongs to which frame) something you need to keep track of more assiduously.

please tell us in more detail what you are trying to accomplish; that will help in picking the correct widgets to be used. if things are hard to do/code in swing, then there's probably an easier way with other widgets/components, imho.

good luck!

Jill Renee