I took a course in C and now im into java. I never created anywith graphics in C. I need to finish a program in C that makes a red ball appear on a blue background and then move down and up the screen.
Any information of how to at least draw an oval or make it move would help...
I know that I need to make the call appear in the center then paint over it and make it appear slightly lower and loop the process, but I do not know any of the code...
This is what I have so far:
import java.awt.*;
import java.applet.Applet;
public class BouncingBall extends Applet {
//Dimensions of Applet:
public final int width = 500;
public final int height = 500;
//Size and speed of ball:
public final int diameter = 20;
public final int speed = 5;
//Milliseconds to pause between frames:
public final int pause = 20;
public void paint (Graphics page) {
setBackground(Color.blue);
//Loop forever;
while (true) {
//Pause between frames:
try { Thread.sleep(pause) ; } catch (Exception e) { };
}
}
}
Thanks