Jim Newsham | 1 Nov 01:05

RE: Swing question: How to exit without System.exit()?


Somebody correct me if I'm wrong, but I believe the event dispatch thread
will terminate after you close and dispose all top-level windows/frames,
etc.

> -----Original Message-----
> From: Vacuum Joe [mailto:vacuumjoe <at> yahoo.com]
> Sent: Tuesday, October 31, 2006 11:23 AM
> To: nbusers <at> netbeans.org
> Subject: [nbusers] Swing question: How to exit without System.exit()?
> 
> I notice that many Swing apps have a Quit button and the action of the
> Quit button does something like System.exit(0).  This is widely-done but
> it's bad.  Very few Java classes should ever use System.exit() because it
> makes it difficult to call them from other apps.  In other words, with a
> well-written Swing app, I should be able to call the main() method of its
> main class and use it and then quit from it without causing the rest of
> the JVM to exit.
> 
> Any suggestions on how to do this?
> 
> Thanks
> 
> 
> 
> 
> 
> 
> __________________________________________________________________________
> __________
(Continue reading)

John Meyer | 1 Nov 01:11
Picon
Gravatar

RPM repositories

hi, does anybody know where the RPM repositories are for Netbeans?

Chuck Davis | 1 Nov 01:18
Picon

Re: Re: Slightly off topic: LAF for KDE

Bryan:

I won't be using anything GNOME based anytime in the near future so I
don't care what it looks like.  Yes, the other IDE is based on SWT
pollution which was a colossal IBM waste of resources for the Java
world.  And while GNOME garners all the corporate support for some
reason, we users, those who have a choice, keep choosing KDE for the
most part.  Of course nobody ever accused corporations of having the
customer's best interest in mind.

Chuck

> >>
> >
> FWIW, the GTK+ LAF looks like gnome.
> Check out:
> http://www.gnusolaris.org/gswiki/ScreenShots?webnail=JDK1.6-NetBeans-JavaApp&action=show
>
> Here you see NetBeans, RiskDimenions on Nexenta (Ubuntu + OpenSolaris)
>
> That being said, I use KDE/Ocean.
> Just wanting to see a match between java apps and the OS...
> The other IDE boasts native look and feel but it looks like gnome on
> KDE, too ;)
> -Bryan
>

Tom Ball | 1 Nov 01:21
Picon

Re: Swing question: How to exit without System.exit()?

Vacuum Joe wrote:
> I notice that many Swing apps have a Quit button and the action of
> the Quit button does something like System.exit(0).  This is
> widely-done but it's bad.  

Since you are the first person I have heard voice this sentiment in the 
past ten years, I think your view isn't widely held.  How about instead 
saying "it doesn't work well with my current design." :-)

> Very few Java classes should ever use
> System.exit() because it makes it difficult to call them from other
> apps.  In other words, with a well-written Swing app, I should be
> able to call the main() method of its main class and use it and then
> quit from it without causing the rest of the JVM to exit.

That's not true, as Swing apps are generally designed to be standalone 
desktop applications, and finishing via System.exit() is what normal 
standalone applications do.  What you describe would be better supported 
by applets -- it's fairly easy to write an applet container if you want 
to run multiple applications within a single JVM instance.

> Any suggestions on how to do this?

In theory (as in, I've never tried it), substitute 
Thread.currentThread().interrupt() for System.exit() from within the 
window closing (or any other) event handler.

Tom

(Continue reading)

Danilo Costa | 1 Nov 01:24
Picon

Re: Swing question: How to exit without System.exit()?

Hi Joe,

your question makes sense. You should actually dispose the frames when they are closed, and when the last one is disposed, the VM exits.

You can do it using setDefaultCloseOparation in JFrame method http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JFrame.html#setDefaultCloseOperation(int)

Cheers


On 10/31/06, Vacuum Joe <vacuumjoe <at> yahoo.com> wrote:
I notice that many Swing apps have a Quit button and the action of the Quit button does something like System.exit(0).  This is widely-done but it's bad.  Very few Java classes should ever use System.exit() because it makes it difficult to call them from other apps.  In other words, with a well-written Swing app, I should be able to call the main() method of its main class and use it and then quit from it without causing the rest of the JVM to exit.

Any suggestions on how to do this?

Thanks






____________________________________________________________________________________
Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates
(http://voice.yahoo.com)




--
"...YOU CANNOT KNOW THE MEANING OF YOUR LIFE UNTIL YOU ARE CONNECTED WITH THE POWER THAT CREATED YOU..."
Shri Mataji Nirmala Devi
Michel Graciano | 1 Nov 01:28
Picon
Gravatar

Re: Re: 100% CPU for Add Operation in Web Service

Bug filed: http://www.netbeans.org/issues/show_bug.cgi?id=88367.
Thanks Lukas.

On 10/31/06, Lukas Jungmann <Lukas.Jungmann <at> sun.com> wrote:
Michel Graciano wrote:
> How can I get the thread dump? I will do this soon.

It depends on your OS, so please check
http://qa.netbeans.org/bugzilla/generating-thread-dumps.html

--lj

>
> On 10/31/06, *Lukas Jungmann* <Lukas.Jungmann <at> sun.com
> <mailto:Lukas.Jungmann <at> sun.com >> wrote:
>
>     Hi,
>
>     Michel Graciano wrote:
>      > Hi,
>      > we are translating nb for pt_BR, and this error just occur if I
>     running
>      > witj internationalized ide. The original IDE don't has this problem.
>      > I found the problem. A term was translated ('operation' >
>     'operação'),
>      > and this is showed on 'Name' field (see attachment), and since
>     this new
>      > value has invalid characters, the dialog freeze the system. I rename
>      > this to 'operacao' and all works good now. :D
>
>     I think that 'operação' is valid method name in java (well, not
>     recommended, but valid - you can try it in simple java class and if
>     compiler compiles it then the name should be valid), so can I ask you
>     file a bug against websvc/code, probably with I18N keyword, so we can
>     look into this deeper? If you could attach a thread dump from freezed
>     IDE there it would be also useful.
>
>     Thanks,
>
>     --lj
>
>
>      >
>      > PS: If some translator are seen this message, be careful with these
>      > situations.
>      >
>      > On 10/30/06, * Michel Graciano* < michel.graciano <at> gmail.com
>     <mailto: michel.graciano <at> gmail.com>
>      > <mailto:michel.graciano <at> gmail.com
>     <mailto:michel.graciano <at> gmail.com >>> wrote:
>      >
>      >     When I try add a new operation for a web service, CPU work
>     for a big
>      >     time with 100% and I need kill the NetBeans IDE. Someone can
>     help me?
>      >     If I create a new WebService and the warning on code (lamp
>     appear if
>      >     any operation are found), the new operation can be added. But
>     if I
>      >     try add a new operation at context menu (Projects > Web
>     Services >
>      >     New Operation), the problem happen.
>      >
>      >     --
>      >     Atenciosamente,
>      >
>      >     Michel Graciano
>      >     KSI Soluções em Informática Ltda.
>      >     http://www.jroller.com/page/hmichel
>      >     http://translatedfiles.netbeans.org/index_pt_BR.html
>     <http://translatedfiles.netbeans.org/index_pt_BR.html >
>      >     https://copypastehistory.dev.java.net/
>      >     https://jae.dev.java.net/
>      >
>      >
>      >
>      >
>      > --
>      > Atenciosamente,
>      >
>      > Michel Graciano
>      > KSI Soluções em Informática Ltda.
>      > http://www.jroller.com/page/hmichel
>      > http://translatedfiles.netbeans.org/index_pt_BR.html
>      > https://copypastehistory.dev.java.net/
>      > https://jae.dev.java.net/ < https://jae.dev.java.net/>
>      >
>     ------------------------------------------------------------------------
>      >
>
>
>
>
> --
> Atenciosamente,
>
> Michel Graciano
> KSI Soluções em Informática Ltda.
> http://www.jroller.com/page/hmichel
> http://translatedfiles.netbeans.org/index_pt_BR.html
> https://copypastehistory.dev.java.net/
> https://jae.dev.java.net/



--
Atenciosamente,

Michel Graciano
KSI Soluções em Informática Ltda.
http://www.jroller.com/page/hmichel
http://translatedfiles.netbeans.org/index_pt_BR.html
https://copypastehistory.dev.java.net/
https://jae.dev.java.net/
stuff | 1 Nov 01:56
Picon
Favicon

Porting from Netbeans 3.5 to 5.5 using SVN

I am attempting to port my application from 3.5 to 5.5. I has proved to be 
challenging. 

I am using svn and when I checkedout from svn I would end up with a folder 
called my_web_app and that became my project folder in netbeans.

My application was developed in mostly 3.5 the folder structure is as follows:

my_web_app
	|
	-->index.jsp
	|
	-->jsp subfolder
				|	
				-->jsp files
	|
	-->WEB-INF
			|
			-->classes
					|
					-->subfolder
							|	
							-->subfolder
									|
									-->java files

I use to mount my_web_app as an svn mount point and all was fine. I see that a 
new project in netbeans will create several quick links for you to your libs 
and other server and project resources (web.xml etc...).

To port my project I created a new project to get everything set up the right 
way. I then deleted the web folder it created and symbolic linked to my svn 
working copy. The reason I did this is because svn wanted to create a folder 
under Web_Pages in the project navigator called my_web_app and then dump the 
files that I think needed to be in Web_Pages root.

Anyhow it builds like nothing is wrong but it is actually not building 
anything at all. It states that: Invalid Package Declaration

Now I can see that it does not have a propper classpath here but I cannot see 
how to fix it. I have been fighting with this for 3 or 4 days and am getting 
no where.

Any help?

Thanks

Bayless Kirtley | 1 Nov 02:12
Picon

Re: Swing question: How to exit without System.exit()?

Can't quite agree Tom. I would think it is common to call one swing class
from another. I have dozens of these within the application I am currently
working on. These are not multiple applications but a single one instead.
A few of my classes are also stand alone and many of the others could
well be if desired.

Working in Netbeans, I create most new classes as JFrames. Then, in
the main class, I don't do anything except submit an invocation of the
constructor to the event queue, the code that Netbeans generates. That
way, I can call its constructor from another class and get exactly the same
behavior.

The only difference required for such a JFrame of this sort is that it must
know how it was instantiated. If the class is called from another class I
use a different constructor that set a property telling it that it is not a 
stand
alone class. When it is time for the class to exit, I check this property. 
If
it was invoked through its main, I call system.exit(). Otherwise, I call
dispose().

This has worked very well for me. In the case of extending a JPanel, I
only do that when it will be used in a JDialog so no main method is ever
needed.

You might give that a try.

Bayless

----- Original Message ----- 
From: "Tom Ball" <Tom.Ball <at> Sun.COM>
To: <nbusers <at> netbeans.org>
Sent: Tuesday, October 31, 2006 6:21 PM
Subject: Re: [nbusers] Swing question: How to exit without System.exit()?

> Vacuum Joe wrote:
>> I notice that many Swing apps have a Quit button and the action of
>> the Quit button does something like System.exit(0).  This is
>> widely-done but it's bad.
>
> Since you are the first person I have heard voice this sentiment in the 
> past ten years, I think your view isn't widely held.  How about instead 
> saying "it doesn't work well with my current design." :-)
>
>> Very few Java classes should ever use
>> System.exit() because it makes it difficult to call them from other
>> apps.  In other words, with a well-written Swing app, I should be
>> able to call the main() method of its main class and use it and then
>> quit from it without causing the rest of the JVM to exit.
>
> That's not true, as Swing apps are generally designed to be standalone 
> desktop applications, and finishing via System.exit() is what normal 
> standalone applications do.  What you describe would be better supported 
> by applets -- it's fairly easy to write an applet container if you want to 
> run multiple applications within a single JVM instance.
>
>> Any suggestions on how to do this?
>
> In theory (as in, I've never tried it), substitute 
> Thread.currentThread().interrupt() for System.exit() from within the 
> window closing (or any other) event handler.
>
> Tom
> 

JC Lee | 1 Nov 02:31
Picon
Favicon

Re: Profiler 5.5 doesn't install!

Hi Jiri,

I've tried to set my winxp's locale and language to U.S. and English, but the problem remains the same. So is there any other workaround for this issue?

btw, my current locale is set to China.

thx.

JC.L

Jiri Sedlacek <Jiri.Sedlacek <at> Sun.COM> wrote:

I've searched on web for similar problems, it may be related to the locale used in your Windows -
please make sure you have English locale set.

Jiri


JC Lee wrote:
> Sorry, the attachment may not work. Here is the error message:
>
> WARNING: cannot instantiate string resolver method
> com.installshield.util.LocalizedStringResolver:
> com.installshield.database.NoSuchDriverException:
> org.apache.derby.jdbc.Embe ddedDriver
> org.apache.derby.jdbc.EmbeddedDriverWARNING: could not delete temporary
> file C:\DOCUME~1\dell\LOCALS~1\Temp\ismp001\7119013
> WARNING: could not delete temporary file
> C:\DOCUME~1\dell\LOCALS~1\Temp\ismp001\3807416
> WARNING: could not delete temporary file
> C:\DOCUME~1\dell\LOCALS~1\Temp\ismp001\4370102
> WARNING: could not delete temporary file
> C:\DOCUME~1\dell\LOCALS~1\Temp\ismp001\6787020
> WARNING: could not delete temporary file
> C:\DOCUME~1\dell\LOCALS~1\Temp\ismp001\8738353
>
> Please help!
> JC.L
>
> */JC Lee /* wrote:
>
> Hi,
>
> My pc is winxp sp2 with jdk1.6 b103. I installed ide, ent-pack, vwp,
> mobile-pack all successfully. But at last when I install profiler I
> got a popup warning(the screen in attachment) .
>
> Just can't figure o ut why.
>
> thx
>
> JC.L
> ------------------------------------------------------------------------
> What will the world find in 2020?
> Leave a part of your 2006 in the Yahoo! Time Capsule. Contribute
> now!
>
>
>
> ------------------------------------------------------------------------
> What will the world find in 2020?
> Leave a part of your 2006 in the Yahoo! Time Capsule. Contribute now!
>
>
<at> yahoo.com.sg>

What will the world find in 2020?
Leave a part of your 2006 in the Yahoo! Time Capsule. Contribute now!
Wade Chandler | 1 Nov 03:05
Picon
Favicon

Re: Swing question: How to exit without System.exit()?

It isn't good best practice "not" to call System.exit
when an application needs to end.  The reason is
different things can happen in a thread including the
AWT threads.  For instances, where one needs to
cleanup they should register shutdown hooks or design
their own mechanism to register actions for shutdown. 
See Runtime.addShutdownHook.  This way no matter if a
Thread is hanging (not stuck in some loop but just not
going away completely...maybe hung on a monitor some
how) the application can cleanly exit.  

I've had different applications where a little bug
here or there which you might not be able to simply
recode down in the JRE could cause the AWT thread or
some other thread you have written to not exit
correctly at times.  When that happens the user exit
the system without kill or the windows task manager. 
Again it could be something as simple as a bug with a
monitor you can't easily debug or figure out.  You may
even have a situation come up where you have to use
halt by starting a thread to watch the shutdown
process.  If you are letting others run code in your
application you do not know what types of Threads they
create and what they do with them in that code...or
their bugs.  See:
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/doc-files/AWTThreadIssues.html

For the case where one needs something run instead
such as a script, a plug-in, or some kind of work flow
the designer of the application can create any types
of hooks and interfaces they would like for the system
to be able to use.  These would not be multiple
applications running inside of the same VM however.  

They would simply be something conforming to some form
of a specification designed for the system.  Like Tom
Ball mentioned one could create an Applet container. 
An Applet container is nothing more than a system
which expects pieces/plug-ins/what ever you want to
call them to conform to a specification so external
code can be executed in it's environment.  This allows
them to be initialized ran and stopped.  A web
application is the same kind of thing.  

Just like in a C++ application.  One can create a
plug-in architecture.  These pieces can run inside the
application.  They just need to conform to some
specification.  If those pieces exit the process then
the process dies.  Java has all the
precreated/packaged/etc protections built in for an
application as the programmer can setup a
SecurityManager to block plug-ins/pieces from calling
certain methods, and these methods can be limited to
certain "trusted" code.

Wade

--- Danilo Costa <danilocosta <at> gmail.com> wrote:

> Hi Joe,
> 
> your question makes sense. You should actually
> dispose the frames when they
> are closed, and when the last one is disposed, the
> VM exits.
> 
> You can do it using setDefaultCloseOparation in
> JFrame method
>
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JFrame.html#setDefaultCloseOperation(int)
> 
> Cheers
> 
> 
> On 10/31/06, Vacuum Joe <vacuumjoe <at> yahoo.com> wrote:
> >
> > I notice that many Swing apps have a Quit button
> and the action of the
> > Quit button does something like System.exit(0). 
> This is widely-done but
> > it's bad.  Very few Java classes should ever use
> System.exit() because it
> > makes it difficult to call them from other apps. 
> In other words, with a
> > well-written Swing app, I should be able to call
> the main() method of its
> > main class and use it and then quit from it
> without causing the rest of the
> > JVM to exit.
> >
> > Any suggestions on how to do this?
> >
> > Thanks
> >
> >
> >
> >
> >
> >
> >
> >
>
____________________________________________________________________________________
> > Cheap Talk? Check out Yahoo! Messenger's low
> PC-to-Phone call rates
> > (http://voice.yahoo.com)
> >
> >
> 
> 
> -- 
> "...YOU CANNOT KNOW THE MEANING OF YOUR LIFE UNTIL
> YOU ARE CONNECTED WITH
> THE POWER THAT CREATED YOU..."
> Shri Mataji Nirmala Devi
> 


Gmane