How to animate Rectangle in JPanel?
I want to learn some tricks about JAVA for my project. I want to animate my Rectangle leftoright and righttoleft but I can't apply the same functions for ball animation. In addition,how can I start my ball in different x-direction with a border of y-coordinate ? Thanks a lot for your advices and helping. My codes: import javax.swing.Timer; import java.util.ArrayList; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class MultipleBall extends JApplet { public MultipleBall() { add(new BallControl()); } class BallControl extends JPanel { private BallPanel ballPanel = new