Forums Register Login

close window

+Pie Number of slices to send: Send
some one please tell me how to close my output window..i wrote Button class program that executed successfully and displayed output window...i'm trying to close that window but that doesn't...please tell me short cut key to close that output window...i placed some methods like dispose() and System.exit(0) but not work..tell me some short cut key please.
+Pie Number of slices to send: Send
What technology are you using?

I think you are looking the following:
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


Call 'System.exit(0)' to stop the program.

dipose(): destroy the object and the garbage collector pick the object.


Thanks,
-M
+Pie Number of slices to send: Send
System.exit shuts down the current JVM. That has to close your window. Are you sure it is being called?

Can you post your code (using the code tags) that show us how you create the window, as well as how you close it?
+Pie Number of slices to send: Send
I think this discussion would fit better in our GUIs forum. Moving.

Avoid System.exit. It can be a bit vicious. If you have several threads running and one has a incomplete task, the JVM will exit leaving the task unfinished and may corrupt your data.
What sort of “output window” do you have? Is it a Dialogue Window?
+Pie Number of slices to send: Send
Closing a JFrame with a defaultCloseOperation of EXIT_ON_CLOSE also calls System.exit(0) (JFrame.java, around line 313).

So any application which might have a thread that needs to run to completion should use DO_NOTHING_ON_CLOSE and handle the exit in a WindowListener, or override processWindowEvent(...).
+Pie Number of slices to send: Send
What about DISPOSE_etc as a closing operation?
+Pie Number of slices to send: Send
I'm placing my code below
+Pie Number of slices to send: Send
Please post that again with correct indentation. The unformatted code is really difficult to read, with or without code tags.
+Pie Number of slices to send: Send
Do you really have to use AWT? Swing, which is itself in 'maintenance mode' replaced AWT more than a decade ago.

If you're stuck with AWT, read the API for Frame.

If the program doesn't explicitly hide or dispose the window while processing this event, the window close operation is canceled.

 
I am mighty! And this is a mighty small ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 708 times.
Similar Threads
short cut keys of MyEclipse 5.5
how do i remember the operator precedence
JDBC
Java and OPC Comm
Get Focus on JEditorPane
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:24:53.