Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to turn an Applet into a Standalone?

 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has to be a very basic question, but since I've never studied GUI in java, I don't know how it works.
I have an Applet, ParticleApplet, that I have copied from Concurrent Programming, by Doug Lea.
How can I make a "main" for this and run it as a standalone?

[ February 13, 2003: Message edited by: Garrett Smith ]
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Garrett Smith:


[ February 13, 2003: Message edited by: Garrett Smith ]


Change the above to this:

Originally posted by Garrett Smith:


[ February 13, 2003: Message edited by: Garrett Smith ]


Replace the above with:

And that should be just about it, me thinks.
Steve
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh wait, a few more I think:
under:
ParticleFrame pf = new ParticleFrame();
add
pf.show();
You may have to set size and some other stuff at
this point as well (you could also set size in the
Constructor where you add canvas).
You may have to add:
pf.repaint();
in the for loop if the particles don't get drawn
Steve
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I got it to work, sort of.
I have some other problems with it, but that may be from copying the example wrong. Anyway, my code so far for this class is:

I'll probably post on the threads forum for the other stuff. This seems to be "the book" for learning threads.
Anyway, thanks for the help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic