ofekkfir

Ellipse

Nov 14th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import canvasML.Ellipse;
  2. public class canvasss
  3. {
  4.  
  5.     /**
  6.      * @param args
  7.      */
  8.     public static void main(String[] args)
  9.     {
  10.         int dx =10;
  11.         int dy =10;
  12.         int x = 0 ;
  13.         int y = 0 ;
  14.         Ellipse el1 = new Ellipse (x, y ,20 , 20,"red");
  15.        
  16.        
  17.         while (true)
  18.         {
  19.             x = x + dx;
  20.             y = y + dy;
  21.            
  22.             el1.moveTo (x,y);
  23.             el1.draw();
  24.            
  25.             if (!(x <= 350 ) && (x >= 50)  )
  26.             {
  27.                 dx = -dx;
  28.                
  29.             }
  30.             if (!(y <= 550)&& (y <= 50) )
  31.             {
  32.                 dy = -dy;
  33.             }
  34.            
  35.        
  36.         }
  37.        
  38.     }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment