SHARE
TWEET

PJATK

a guest Apr 19th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Main extends JFrame{
  2.  
  3.     final int TITLE_BAR_HEIGHT = 20;
  4.     int x, y, radius;
  5.     int dx, dy;
  6.  
  7.     public Proje(){
  8.  
  9.         this.x = 20;
  10.         this.y = 50;
  11.         this.radius = 100;
  12.         this.dx = 1;
  13.         this.dy = 1;
  14.  
  15.         setSize(640, 640);
  16.         setTitle("Shapes");
  17.         setVisible(true);
  18.         setDefaultCloseOperation(ShapeWindow.EXIT_ON_CLOSE);
  19.     }
  20.  
  21.     public void paint(Graphics g) {
  22.         super.paint(g);
  23.  
  24.         g.clearRect(0, 0, getWidth(), getHeight());
  25.         g.setColor(Color.BLUE);
  26.         g.drawOval((getWidth()-radius)/2 , (getHeight()-
  27.                 radius+TITLE_BAR_HEIGHT)/2, radius, radius);
  28.  
  29.         g.setColor(Color.MAGENTA);
  30.         g.drawRect((getWidth()-150)/3, ((getHeight()-150+TITLE_BAR_HEIGHT)/3),
  31.                 radius, radius);
  32.  
  33.         g.setColor(Color.MAGENTA);
  34.         g.drawRect(((getWidth()-80)/3)*2,
  35.                 (getHeight()-150+TITLE_BAR_HEIGHT)/3, radius, radius);
  36.  
  37.     }
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top