Animation in Java Swing
Moving components in Java is pretty hard, but with this Application Programming Interface (API), you can simply move smoothly and easily with the components using “Kensoft Animation API“.
Kensoft Animation
With this Jar file, you can actually move like jButton, jLabel, jPanel, etc. Download the .jar file and implement it in your Java application.
Add the Kensoft Animation.jar to your libraries and import it into your code. Once you imported the package and the class. Create an object of Animation and call the public methods when you need it.
Kensoft animate = new Kensoft(); // Object of Animation
The public methods are parameterized with int start, int stop, int delay, int increment, and the component you want to animate.
-
int start – is the value of X or Y coordinate
-
int stop – is the value of X or Y coordinate
-
int delay – is the value of milliseconds. Delay is a period of time by which something late or postponed
-
int increment – is the value (one or 1 is smoother) of the increment. It depends on you whether you run it smoothly.
-
and the component you want to animate. ( Button, Label, or whatsoever)
The syntax for importing the package
import KentHipos.Kensoft;
Calling the public methods
animate.jLabelXRight(10, 500, 1, 1, jLabel);
The animation or movement here is fast and smooth because of 1 millisecond of delay and 1 increment value.
Sample Code
private void jLabelMouseClicked(java.awt.event.MouseEvent evt){ Kensoft animate = new Kensoft(); animate.jLabelXRight(10, 500, 1, 1, jLabel); }
Comments 1