• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

looking for non-applet science simulations

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For my programming students, I'm looking for non-applet (and non-JApplet) science simulations written in java. Most simulations seem to be in applet or JApplet format. Any suggestions on where to look for simulations that would be interesting to programmers and science (physics, chemistry, biology, et cetera) students?

cheers!
Bill

<wstanard@palmertrinity.org>
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why non-Applet?

Most Applets and JApplets can be run as applications with the addition of a suitable main() routine:



As I said, this will work for many applets -- but not all.
 
Bill Stanard
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming a simple applet such as the following...

...where do I add the code that you suggest? Or do I rewrite my code to fit the pattern that you suggest? Sorry to be so thick...
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The important part of this is the main() method. I showed inside an entirely separate class, but you can just take the "public static void main() { ... }" part and put it into the WelcomeApplet class itself. Change "TheApplet" in my code to "WelcomeApplet", compile the applet, and then run the result with

java WelcomeApplet

from the command line.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course, if you don't want to "pollute" your applet class, you can use Ernest's example as a separate class in a separate file basically as it is.

Layne
 
author
Posts: 23907
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the "appletviewer" option still available? That use to be my favorite option to run applets from the command line.

Henry
 
Bill Stanard
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Ernest & Layne,
It works... but... I need to grab and then resize the frame before it shows anything (in the case of the WelcomeApplet, the helloLabel). Any idea why this is? I've noticed it a lot with some of the applets I write, that text fields or labels are quite often hidden until the applet (frame) is grabbed and resized. Then all is well.
cheers!
Bill
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because the components are added after the applet is visible on the screen; the LayoutManager needs a special notification that you're done changing the screen before it actually does anything. You should be able to fix this by moving the init() call to just before the setVisible() call -- I suppose I've misled you in not doing it that way in the first place.
 
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic