Re: New applet project
On Feb 3, 9:36 pm, Daniel Moyne <dmo...@tiscali.fr> wrote:
I want to start a new project and I want to make sure to head in the right
I want to publish on my web site some work I did before in Basic language
for a French computer magazine ; this is basically about "Mechanics
Assisted by Computer" ; I modelized the behaviour of a small objects moving
on a plane and bouncing on walls of different shapes ; the algoritms are
quite simple but I will have to handle all this though applets
Not necessarily. A web start application (or applet)
cna be launched from a web page.
..to show the
object moving in a window ; I have also some text attached to this work
everything written in Latex that I think needs to be converted in HTML to
be displayed as well.
Java 1.2+ introduced Swing components that
understand/render simple HTML.
Ok my questions :
(1) What packlages do I need : canvas ? ;
Note that (java.awt.)Canvas is part of the AWT,
and is this day and age, you are far better off
looking to Swing for good GUI's.
If using the AWT, I would probably just use a
Panel, a Canvas has a lot of unnecessary cruft,
and I have never found it good for much.
If using Swing, a JPanel.
... everything in in 2D ;
AWT offers the Graphics object, whereas you
can usually rely on getting a Graphics2D
object, when dealing with Swing.
I was doing improvements to a simple
space simulator recenlty, it was AWT,
but I had a hankering to take it to Swing,
just for the GradientPaint available to
a G2D object.
..I want to
draw some mathematic curves line straight lines, circles inside colored ,
parabol and so on.
Java has the Math class, check it out.
That and simple Java arithmetic should
cover the math side of it.
Beyond that, both Graphics and Grahics2D
should cover what you describe.
(2) If not mistaken I will have a fixed window to start with to active my
applet inside my web page with dimensions specified in a pure static mode ;
There are a number of quirky ways to get a
dynamically sized window, but nothing that
works well for all browsers. Here is one example.
The applet on that page should take up the
entire width of the page, and resize as the
page is made wider/thinner. There are other
'full window' examples, the best is ..
*Or*, you can have a free floating, resizable
application, using web start.
frome there on can I open other window(s) to display my graphics ?
Yes, applets can open dialogs, frames, windows
(4) at the beginning I want to start with a set of variables to set what I
would call initial state including position of objects, initial speed,
etc.. but later I want to set this graphically with an interractive window
where the user see "the scene" and can move the objects and parameters like
speed (vector) ; can I use some piece of code here already existing ?
I am not sure what you mean, but there are any
number of open source rendering examples that
offer user configuration.
Here are two..
The Space Simulator I mentioned earlier (AWT based)..
(download source and build file at link 7)
Other examples of rendering..
Each JNLP launchs a diffferent screensaver, e.g.
the saver settings can be configured (to some
extent, within the confines of a sandboxed
application, via. the dialog available through
F-10), and the help (F-1) is HTML rendered
by Swing components.
The Banner Scroller example also uses the
GradientPaint so sorely missed from Java