Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. package h05_apioefening;
  2.  
  3. import java.awt.*;
  4.  
  5. public class Tralies
  6. {
  7.     private int x, y, width, height;
  8.     private int grootte = 200;
  9.     private boolean raised;
  10.  
  11.     public Tralies(int x, int y, int width, int height, boolean raised)
  12.     {
  13.         this.x = x;
  14.         this.y = y;
  15.         this.width = width;
  16.         this.height = height;
  17.         this.raised = raised;
  18.     }
  19.  
  20.     public void tekenen(Graphics g)
  21.     {
  22.         int smile_y = x + 30;
  23.         int smile_x = x + 30;
  24.  
  25.         // maak smile :D
  26.         g.setColor(Color.yellow);
  27.         g.fillOval(smile_x, smile_y, grootte, grootte);
  28.  
  29.         // maak de ogen
  30.         g.setColor(Color.black);
  31.         g.fillOval(smile_x + ((grootte / 2)), smile_y + (smile_y / 8),
  32.                 grootte / 5, grootte / 5);
  33.  
  34.         g.fillOval((smile_x - 50) + ((grootte / 2)), smile_y + (smile_y / 8),
  35.                 grootte / 5, grootte / 5);
  36.  
  37.         // maak de lach
  38.         g.setColor(Color.white);
  39.         g.fillArc(smile_x + 50, smile_y + (smile_y / 2), grootte / 2,
  40.                 grootte / 2, -180, 180);
  41.  
  42.         // maak het venster van de tralies
  43.         g.setColor(Color.black);
  44.         g.draw3DRect(x, y, width, height, raised);
  45.  
  46.         // maak de tralies
  47.         g.setColor(Color.gray);
  48.         for (int i = 0; i < 280; i += 40)
  49.         {
  50.             g.fillRoundRect(x + i, y, 10, height, 10, 20);
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement