View Full Version : dispose(); function

02-18-2008, 05:46 PM
Hi all,

I have a program, which is situated on a JFrame, and when a particular button is clicked, this opens a smaller JFrame (a completley seperate window).

There is then a button on this new JFrame that is meant to close the current frame (the smaller one). I have disabled the "X" button on this secondary frame with:


as it will cause errors if idiots just close it before doing what they are meant to do.

A simple if statement with a


allows me to do this.

Anyhow... On this close button on the frame, when I use the dispose(); fucntion, it closes the MAIN Jframe window in the background! Ive tried assigning the dispose function directly to the secondary frame: changeFrame.dispose(); but nothing works. Is there a better way of doing this than using the dispose function, or if not, can someone explain to me how to configure this function to make it close the desired frame?

Thanks in advance.