473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

HowTo exit from an application

I have an application that use awt and Swing, with this code :

public void windowClosing(WindowEvent e) {
Window window = e.getWindow();
if (window.equals(this)) {
setVisible(false);
dispose();
}
}

But when I close it some resources remain occuped and I can have prompt
until I press CTRL C. Why ?

_____
Flex
May 5 '06 #1
10 12007
"Flex" <fl******@ammsreprogrammareweb.com> wrote in message
news:pa****************************@ammsreprogramm areweb.com...
I have an application that use awt and Swing, with this code :

public void windowClosing(WindowEvent e) {
Window window = e.getWindow();
if (window.equals(this)) {
setVisible(false);
dispose();
}
}

But when I close it some resources remain occuped and I can have prompt
until I press CTRL C. Why ?


The easiest way to get your program to quit when you close the window is to
use the setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

- Oliver

May 5 '06 #2
Il Fri, 05 May 2006 16:33:52 +0000, Oliver Wong ha scritto:
The easiest way to get your program to quit when you close the window is to
use the setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


It's the same, I don't understand why, but something remains open..

____
FleX

May 5 '06 #3

"Flex" <fl******@ammsreprogrammareweb.com> wrote in message
news:pa****************************@ammsreprogramm areweb.com...
Il Fri, 05 May 2006 16:33:52 +0000, Oliver Wong ha scritto:
The easiest way to get your program to quit when you close the window is
to
use the setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


It's the same, I don't understand why, but something remains open..


Can you post an SSCCE demonstrating the problem?
http://mindprod.com/jgloss/sscce.html

- Oliver

May 5 '06 #4
Il Fri, 05 May 2006 22:11:11 +0000, Oliver Wong ha scritto:
Can you post an SSCCE demonstrating the problem?
http://mindprod.com/jgloss/sscce.html


it'is not simple, because this is a big application, with some class, I
need a method to understand what remains open after exit.

___
FleX

May 6 '06 #5
Flex wrote:
But when I close it some resources remain occuped and I can have prompt
until I press CTRL C. Why ?


Like, command prompt? Well if run your program from command prompt (like
"java MyClass") of course then it will return to wherever it started
from... and that's command prompt.
If not, you didn't close the "main" thread (like JFrame thing Oliver
suggested) or have some other thread running.

--
Kova
May 6 '06 #6
"Flex" <fl******@ammsreprogrammareweb.com> wrote in message
news:pa****************************@ammsreprogramm areweb.com...
Il Fri, 05 May 2006 22:11:11 +0000, Oliver Wong ha scritto:

it'is not simple, because this is a big application, with some class, I
need a method to understand what remains open after exit.


What about having an observer that all the windows notify when they open
or close, and so the observer always has an accurate list of the open
windows, and can exit as appropriate?

- Oliver

May 8 '06 #7
Il Sat, 06 May 2006 20:37:42 +0200, Kova ha scritto:
Like, command prompt? Well if run your program from command prompt (like
"java MyClass") of course then it will return to wherever it started
from... and that's command prompt.
If not, you didn't close the "main" thread (like JFrame thing Oliver
suggested) or have some other thread running.


I run the GUI program from a x-terminal and when I close it, javaVM
remain in memory, but I cannot understand why..

_____
FleX
May 8 '06 #8
Il Mon, 08 May 2006 14:00:57 +0000, Oliver Wong ha scritto:

What about having an observer that all the windows notify when they open
or close, and so the observer always has an accurate list of the open
windows, and can exit as appropriate?


it's strange, when I try to run the application in debug mode (with
Netbeans) i receive this error :
Listening on 55850
User program running
Breakpoint hit at line 497 in class java.lang.Integer by thread main.
Thread main stopped at Integer.java:497.

and the application doesn't run.

____
FleX

May 8 '06 #9

"Flex" <fl******@ammsreprogrammareweb.com> wrote in message
news:pa****************************@ammsreprogramm areweb.com...
Il Mon, 08 May 2006 14:00:57 +0000, Oliver Wong ha scritto:

What about having an observer that all the windows notify when they
open
or close, and so the observer always has an accurate list of the open
windows, and can exit as appropriate?


it's strange, when I try to run the application in debug mode (with
Netbeans) i receive this error :
Listening on 55850
User program running
Breakpoint hit at line 497 in class java.lang.Integer by thread main.
Thread main stopped at Integer.java:497.


Remove the breakpoint, or press continue on the debugger.

- Oliver

May 8 '06 #10
Flex wrote:
Il Sat, 06 May 2006 20:37:42 +0200, Kova ha scritto:
Like, command prompt? Well if run your program from command prompt (like
"java MyClass") of course then it will return to wherever it started
from... and that's command prompt.
If not, you didn't close the "main" thread (like JFrame thing Oliver
suggested) or have some other thread running.


I run the GUI program from a x-terminal and when I close it, javaVM
remain in memory, but I cannot understand why..

_____
FleX


Have you tried adding System.exit(0); ???
It's a classic when it comes to closing an app...
May 8 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rene Crespo | last post by:
Hello, I am using MSAccess 2000. I generated my application using my home PC and then transfered the file to a server at work. When I close the application, I get the following error: "Table...
4
by: Chuck | last post by:
Hello everybody, I need to abort execution during start up, while the constructor called by Application.Run is executing. If the database fails to connect during my application's startup I...
3
by: Zack Whittaker \(R2 Mentor\) | last post by:
I think I'm starting to get the hang of this you know... bit by bit things are starting to get much easier! :oD Just wondering though, I've got a nice menu with popup dialogs with about boxes......
1
by: kong | last post by:
i'm very new to asp.net... i'm facing problem since i want to run the application... i put my connection string (strConnect) in a module (moduleConnect) then when my first form load, i want to...
2
by: tt | last post by:
Hi, ANy ideas on this? When I click the close button of a window in VB.net which method gets called? I used Applicaton.exit in some method of my appln. to exit the application but, it still...
3
by: Simon | last post by:
I need to force a exit if a critical file is not found???
1
by: Daniel | last post by:
Hallo, I'd like to hide application in Pocket PC. My application is written in C# 2.0 for WM 5.0. I have some questions: 1. When it starts in takes about 5-6 seconds. The whole application...
6
nev
by: nev | last post by:
when i click the 'x' box of a form to exit i get the Error creating window handle. but when i use my file menu exit menuitem which does... Global.System.Windows.Forms.Application.Exit() my...
2
by: dantz | last post by:
Hi Everyone, Currently I am having this exception: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I am still debugging which part of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.