Click to See Complete Forum and Search --> : How to close a Frame via MouseClick?


Trollpower
May 11th, 2000, 09:27 AM
Hi there!

I made a little Program which uses a Frame with Labels in it to show some Text.
The Problem i have is how to close this Frame just by clicking on it with my Mouse.

I allready implements MouseListener and implments all the methods it needs, but it wont close if i click in it.

Thanks for your help...

Trollpower

kannanbalu
May 11th, 2000, 09:38 AM
Do you mean that you want to close the frame whereever you click on it?

Kannan

Trollpower
May 11th, 2000, 09:41 AM
yes. But for the beginning it is ok if i have to click on a single spot in the Frame (Title, Screen).

Greetings

Trollpower

Trollpower
May 11th, 2000, 09:43 AM
i thought that i can add such a Listener simply by "putting" it around the Object itself. For example:

mouseListener(){
Frame myFrame = new Frame();}

something in this way, you know?

Trollpower

poochi
May 11th, 2000, 11:06 AM
frame.hide();
frame.dispose();

System.exit( 0 ) // If you like to terminate the application.