Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

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
0
dkim18
Asked:
dkim18
  • 5
  • 3
  • 2
1 Solution
 
CEHJCommented:
If it's a JFrame or Frame, just do

frame.dispose();

Remember, you can't do System.exit in an applet
0
 
objectsCommented:
Use showDocument() to load a new empty page.
0
 
dkim18Author Commented:
It is not Frame, but JApplet
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
objectsCommented:
then use showDocument:

applet.getContext().showDocument(url);
0
 
CEHJCommented:
What is

>>The top-level window

then?
0
 
objectsCommented:
Or if you don't want to switch page for some reason then remove the content from your applets root pane.
0
 
CEHJCommented:
Have you got an applet inside a frame? What is the relationship between application/applet or frame/applet?
0
 
dkim18Author Commented:
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
 
objectsCommented:
with the code i posted in your other question have your exit action do:

f.hide();

0
 
objectsCommented:
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now