Guest User

Untitled

a guest
Feb 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. import java.lang.System.*;
  2. import java.util.*;
  3. import java.awt.*;
  4. import java.awt.event.*;
  5.  
  6. public class WHALE
  7. {
  8. public static void main(String[] args)
  9. {
  10. new SketchPad();
  11. }
  12. }
  13.  
  14. class SketchPad extends JFrame
  15. {
  16. SketchPad()
  17.  
  18. {
  19. Color blue = new Color(34, 68, 180);
  20. setBackground(blue);
  21.  
  22. setTitle("SketchPad");
  23. setSize(600,400);
  24. setResizable(false);
  25. setLocationRelativeTo(null);
  26. setDefaultCloseOperation(EXIT_ON_CLOSE);
  27. setVisible(true);
  28. }
  29.  
  30. public void paint(Graphics screen)
  31. {
  32. whale(screen,50,100);
  33. }
  34.  
  35. public void whale(Graphics g, int x, int y)
  36. {
  37. g.setColor(new Color(6,174,255));
  38. int xPoints[] = {x+16,x+27,x+42,x+50,x+49,x+64,x+75,
  39. x+86,x+99,x+109,x+114,x+112,x+102,x+88,x+76,x+63,x+61,
  40. x+63,x+67,x+85,x+99,x+119,x+132,x+141,x+155,x+171,x+191,
  41. x+216,x+240,x+258,x+281,x+290,x+298,x+299,x+293,x+274,x+250,
  42. x+184,x+70,x+49,x+33,x+29,x+38,x+40,x+28,x+17,x+2,x+2,x+2};
  43.  
  44. int yPoints[] = {y+44 ,y+41,y+49,y+62,y+75,y+64,y+56,y+45,
  45. y+52,y+61,y+75,y+92,y+107,y+99,y+92,y+97,y+112,y+128,y+146,
  46. y+158,y+155,y+139,y+117,y+103,y+84,y+76,y+72,y+68,y+69,y+73,y+89,
  47. y+104,y+124,y+167,y+190,y+203,y+215,y+226,y+227,y+217,y+202,y+146,
  48. y+108,y+92,y+84,y+89,y+97,y+73,y+57};
  49.  
  50. int numOfPoints = 49;
  51. g.fillPolygon(xPoints,yPoints,numOfPoints);
  52. }
  53. }
Add Comment
Please, Sign In to add comment