On Sun, 19 Mar 2006 22:34:24 GMT, "Kurt M Peters"
<nospampeterskurt@atmsn.com> wrote, quoted or indirectly quoted
someone who said :
>Normally, one could simply use args[] as an array, but since the
>myJavaApplication is "encased" in an "invokeLater" internal method, I don't
>see how to pass args to the application itself in any useful manner. Does
>anyone have any suggestions for a way around this?
>Regards,
>Kurt
here are three ways of doing it.
1. You could have the app itself implement Runnable then main can pass
it all the parms it wants to the constructor, or leave them lying
around in statics.
2. pass your Runnable some parameters in its constructor.
3. have your Runnable.run examine some local finals in main.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Stefan Ram - 20 Mar 2006 00:00 GMT
>2. pass your Runnable some parameters in its constructor.
In this case »args« might also need to be declared as »final«.
public class Main
{ public Main( final java.lang.Object object ){}
public void setVisible( final boolean value ){}
public static void main( final java.lang.String[] args )
{ java.awt.EventQueue.invokeLater(new Runnable()
{ public void run(){ new Main( args ).setVisible( true ); }}); }}
>3. have your Runnable.run examine some local finals in main.
Kurt M Peters - 20 Mar 2006 02:17 GMT
Thanks for the quick response.
I hate to press my luck, but (1) seems "easiest" to me, although it
throws me clear out of my "safe zone". So, if I have it implement Runnable,
how would the inside look for the "run" method?
I'm assuming the main is changed to:
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new myJavaApplication(args));
}
My problem is a lack of understand of threads. What would I need in "run"?
I assume it's called automatically?
Is this all I need?
public void run() {
setVisible(true);
}
thanks again,
Kurt
> On Sun, 19 Mar 2006 22:34:24 GMT, "Kurt M Peters"
> <nospampeterskurt@atmsn.com> wrote, quoted or indirectly quoted
[quoted text clipped - 17 lines]
>
> 3. have your Runnable.run examine some local finals in main.
Roedy Green - 20 Mar 2006 02:24 GMT
On Mon, 20 Mar 2006 01:17:36 GMT, "Kurt M Peters"
<nospampeterskurt@atmsn.com> wrote, quoted or indirectly quoted
someone who said :
>My problem is a lack of understand of threads.
There are no threads created.. You are just borrowing the run method
of Runnable. All that happens is Swing will invoke your run method at
some point in future.
Your Runnable is very much like a Swing event handler. You can get
data in the same three ways.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Roedy Green - 20 Mar 2006 02:25 GMT
On Mon, 20 Mar 2006 01:17:36 GMT, "Kurt M Peters"
<nospampeterskurt@atmsn.com> wrote, quoted or indirectly quoted
someone who said :
>I assume it's called automatically?
> Is this all I need?
> public void run() {
> setVisible(true);
> }
>thanks again
see http://mindprod.com/jgloss/japplet.html
for the complete code to turn an Applet into an application.
See http://mindprod.com/jgloss/jframe.html
for sample code to fire up an application with this technique.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
...
> Normally, one could simply use args[] as an array, but since the
> myJavaApplication is "encased" in an "invokeLater" internal method, I don't
> see how to pass args to the application itself in any useful manner. Does
> anyone have any suggestions for a way around this?
...
In addition to the answers already posted, remember that implementing a
Runnable as an anonymous inner class is an option, not a requirement.
Patricia