Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

File menu and Exit: Invoking closing the window

Posted on 2003-11-25
10
269 Views
Last Modified: 2010-03-31
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
0
Comment
Question by:dkim18
  • 5
  • 3
  • 2
10 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 9817650
If it's a JFrame or Frame, just do

frame.dispose();

Remember, you can't do System.exit in an applet
0
 
LVL 92

Expert Comment

by:objects
ID: 9820562
Use showDocument() to load a new empty page.
0
 

Author Comment

by:dkim18
ID: 9828698
It is not Frame, but JApplet
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 92

Expert Comment

by:objects
ID: 9828721
then use showDocument:

applet.getContext().showDocument(url);
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9828756
What is

>>The top-level window

then?
0
 
LVL 92

Expert Comment

by:objects
ID: 9828769
Or if you don't want to switch page for some reason then remove the content from your applets root pane.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9828818
Have you got an applet inside a frame? What is the relationship between application/applet or frame/applet?
0
 

Author Comment

by:dkim18
ID: 9828970
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

0
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 9829008
with the code i posted in your other question have your exit action do:

f.hide();

0
 
LVL 92

Expert Comment

by:objects
ID: 9879393
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 65
Apps blocked by Java 9 88
HashTable highest marks enumeration alternative 9 42
Way to decrease size of apk file 9 86
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question