Link to home
Start Free TrialLog in
Avatar of dkim18
dkim18

asked on

File menu and Exit: Invoking closing the window

I am working on java applet and trying to implement the following.

The top-level window has a File menu containing a menu item "Exit". When "Exit" is invoked the application will close the window (the user sees an empty applet page with just the title and header)

I did implement the appearance file menu and exit option, but does nothing.)
How do I implement the above "Exit" behavior?

Thank you for help
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

If it's a JFrame or Frame, just do

frame.dispose();

Remember, you can't do System.exit in an applet
Use showDocument() to load a new empty page.
Avatar of dkim18
dkim18

ASKER

It is not Frame, but JApplet
then use showDocument:

applet.getContext().showDocument(url);
What is

>>The top-level window

then?
Or if you don't want to switch page for some reason then remove the content from your applets root pane.
Have you got an applet inside a frame? What is the relationship between application/applet or frame/applet?
Avatar of dkim18

ASKER

Please refer below site to all your questions. It is going to be better than my explnation.
There is a sample picture for this applet, so you can get better understanding.

http://webdev.apl.jhu.edu/%7Emed/fall03/homework/04LibrarySwing.html

ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial