Hi, i am making a simple program that uses Graphics and this is the first time that i used this Graphics,now what i want is to move the circle inside in my JFrame and controlled by the arrow up,down,left and right.
How can i accomplished this.?
import java.util.*; import java.awt.*; import javax.swing.*; public class TestPoint extends JFrame { public TestPoint() { setTitle("Moving circle"); setSize(400,400); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void paint(Graphics g) { super.paint(g); this.setBackground(Color.white); g.setColor(Color.RED); g.fillOval(10,100,10,10); } public static void main(String[]c) { TestPoint t = new TestPoint(); t.setBackground(Color.white); } }