Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. package stap0;
  2.  
  3. import javax.swing.*;
  4. import java.awt.*;
  5.  
  6. public class CopyOfZeilboot extends JPanel
  7. {
  8. private int x = 100;
  9. private int y = 400;
  10. private int breedteBoot = 200;
  11. private int hoogteBoot = 100;
  12. private int breedteMast = 15;
  13. private int hoogteMast = 300;
  14. private int schuineZijde = 50;
  15.  
  16. public CopyOfZeilboot(int breedteMast, int hoogteMast, int breedteZeilboot, int hoogteZeilboot)
  17. {
  18. this.breedteMast = breedteMast;
  19. this.hoogteMast = hoogteMast;
  20. this.breedteBoot = breedteZeilboot;
  21. this.hoogteBoot = hoogteZeilboot;
  22. }
  23.  
  24. public void teken( Graphics g)
  25. {
  26. int[] bootX = {x, breedteBoot + x, ((breedteBoot+ x) - schuineZijde), x + schuineZijde};
  27. int[] bootY = {y, y, y+hoogteBoot, y+hoogteBoot};
  28. int[] zeilX = {x+breedteBoot, x+breedteBoot, x};
  29. int[] zeilY = {x,x+breedteBoot,breedteBoot+x};
  30.  
  31. g.setColor(Color.PINK);
  32. g.fillPolygon(bootX, bootY,4);
  33. g.setColor(Color.darkGray);
  34. g.fillRect(x + (breedteBoot /2), 100, breedteMast, hoogteMast);
  35. g.setColor(Color.CYAN);
  36. g.fillPolygon(zeilX, zeilY,3);
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement