Solved

File menu and Exit: Invoking closing the window

Posted on 2003-11-25
10
266 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSum6 challenge 6 76
firstswap challenge 20 65
HSSFWorkbook cannot be resolved error 10 50
Java Options in Zimbra Server 2 44
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
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.

911 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now