/** *Text generated by Simple GUI Extension for BlueJ *Update by Jeff Borland * * **/ import java.awt.*; /** *Description of project goes here *Author * * **/ public class GUI_project extends BorlandBase { int ballX=200,ballY=200; int xSpeed=10,yspeed=10; //Constructor public void initialize(){ setWidth(500); setHeight(400); setScreenLayout(null); setBackgroundColor(new Color(192,192,192)); //Below is for animation setAnimation(true); setDelay(50); //adding components to contentPane panel } //If you would like something painted when program opens public void paintScreen(Graphics g) { } //The method below will get called every frame. //its parameter g is the temporary graphics layer public void update(Graphics g) { //put your code for what should happen each animation g.fillOval(ballX,ballY,20,20); ballX=ballX+xSpeed; if (ballX>500) ballX=0; echo ("ballX is " + ballX); } public static void main(String[] args){ try{ BorlandBase.main((BorlandBase)(new Object() { }.getClass().getEnclosingClass().newInstance())); } catch (Exception e){e.printStackTrace();} } }