I want to close only the current window

Hello, I have an application that calls some function to display an image in a separate window, and If I close this window, my application is closed too.

What should I type instead of System.exit(0) in the following code?

publicclass ImageFrameextends Frame

{

WindowListener listener=new WindowAdapter()

{publicvoid windowClosing(WindowEvent e)

{ System.exit(0);

}

};

[757 byte] By [tleis1a] at [2007-10-1 2:10:56]
# 1
Your component is a Frame, so you can use this.hide() to hide the frame and this.dispose() to close the frame and remove this object from memory.
RachelSwailesa at 2007-7-8 10:40:42 > top of Java-index,Administration Tools,Sun Connection...
# 2

thank you

I used dispose(), and it worked fine.

but why I got compilation errors when I use this.dipose();

why this isn't refering to the frame?

WindowListener listener=new WindowAdapter()

{ public void windowClosing(WindowEvent e)

{ dispose();

}

};

tleis1a at 2007-7-8 10:40:42 > top of Java-index,Administration Tools,Sun Connection...
# 3
The only reason I can think of for the compilation time error is that the this.dispose if placed in that location will refer to the WindowListener object that you have created.
RachelSwailesa at 2007-7-8 10:40:42 > top of Java-index,Administration Tools,Sun Connection...
# 4
Hi againthis time i am not using the window listener, i am using the Action Listener, and using dispose() to close the frame do not work. any solution?
tleis1a at 2007-7-8 10:40:42 > top of Java-index,Administration Tools,Sun Connection...