tags:

views:

33

answers:

2

I have a frame and I want to show some white sphere in the different location in my frame,I have researched a lot but I found some codes for using applets but i don't want to use applets. please help me with some code or references. Thanks.

+3  A: 

Sun has published a large list of Java 2D examples, many of which include animation. You should be able to copy the techniques used there. Take a look!


Note: "Java 2D" sounds like some API that you'd need to download a new library for. This is not the case: Java 2D is part of the "normal" JDK/JRE libraries.


Another note: There's not too much difference between an Applet showing graphics and a desktop application. To convert a Swing Applet to a desktop application, most of the effort is replacing JApplet with JFrame, and moving the applet's init code into the JFrame's constructor. So if you see example code for applets, don't throw it out the window as it can still be useful to you.

Carl Smotricz
Thanks.I will try it.
Johanna
Carl's right about applets. This simple animation example runs as either an application or an applet: http://sites.google.com/site/drjohnbmatthews/subway
trashgod
A: 

You may also like this Java 2D games tutorial that discusses several animation techniques.

trashgod