...
>..i have a java application (JPanel) and
>it work as a main window and then, im trying to launch a java
>application (JFrame) but when i close the JFrame window, the main
>window also terminated.
>
>is somebody know this?
Look at the method
javax.swing.JFrame.setDefaultCloseOperation(int).
The default is JFrame.DO_NOTHING_ON_CLOSE, but I
suspect your IDE has other 'ideas'.
By the way. Sentences in English should start with a single
Upper Case letter to help the reader tell where they start and
end. Also, the word I or the abbreviation I'm, should also start
with upper case. 'I' is always upper case.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
jerry - 30 Oct 2007 10:23 GMT
> ..
>
[quoted text clipped - 19 lines]
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
Thank you for correction, I really appreciate it.
I tried the code above and it seems work to me. But my problem is,
I've created a program that will launch
application from jar file, so means I don't have access on it. This
jar file is a collection
of window application.
If the application(JFrame/Other Object) has this code:
(probably a child window)
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt)
{
System.exit(0);
}
});
the main window (Launcher) exit too.
Andrew Thompson - 30 Oct 2007 10:41 GMT
...
>I tried the code above and it seems work to me. But my problem is,
>I've created a program that will launch
>application from jar file, so means I don't have access on it. This
>jar file is a collection
>of window application.
...
> System.exit(0);
...
>the main window (Launcher) exit too.
Unless you implement an 'ExitManager'* to prevent
the other applications from doing that.
*
<http://groups.google.com/group/comp.lang.java.programmer/msg/f29ab45389d9f5f2
Whether the other apps. handle that gracefully is
another matter. You may need to explicitly
setVisble(false) and take other measures.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Andrew Thompson - 30 Oct 2007 10:54 GMT
>...
>>I tried the code above and it seems work to me. But my problem is,
[quoted text clipped - 8 lines]
>
>Unless you implement an 'ExitManager'* ...
Or, I realise now as I reread Arne's reply, start the other
apps. in entirely new Process(es).
OTOH - I think the current approach using the code you
have + an ExitManager, has more control over the resulting
application.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
jerry - 30 Oct 2007 14:56 GMT
> Look at the method
> javax.swing.JFrame.setDefaultCloseOperation(int).
[quoted text clipped - 8 lines]
> --
> Andrew Thompsonhttp://www.athompson.info/andrew/
Thank you for correction, I really appreciate it.
I tried the code above and it seems work to me. But my problem is,
I've created a program that will launch
application from jar file, so means I don't have access on it. This
jar file is a collection
of window application.
If the application(JFrame) has this code:
(probably an application that will launch from main window)
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt)
{
System.exit(0);
}
});
the main window (Launcher) exit too.
> [code]
> Class[] argTypes = { String[].class };
[quoted text clipped - 9 lines]
> application (JFrame) but when i close the JFrame window, the main
> window also terminated.
The two "things" are running in the same process. If closing the
JFrane result in a a call to System.exit, then the entire process
is exited.
But you can control that - see Andrews posts for some Swing hints.
Arne
>ClassLoader.getSystemClassLoader().loadClass(className)
would you not normally code that as
Class.forName( className )

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Daniel Pitts - 28 Oct 2007 00:38 GMT
>> ClassLoader.getSystemClassLoader().loadClass(className)
>
> would you not normally code that as
> Class.forName( className )
Not if you wanted it to be loaded by a specific ClassLoader

Signature
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>