Advertisement
Guest User

Biohazard

a guest
Apr 26th, 2010
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. package test;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5.  
  6. import javax.swing.JComponent;
  7. import javax.swing.JFrame;
  8.  
  9. public class BioHazardReal {
  10. public static void main(String[] args) {
  11. new BioHazardReal();
  12. }
  13.  
  14. public BioHazardReal() {
  15. JFrame frame = new JFrame("Biohazard");
  16. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  17. frame.getContentPane().add(new BioHazardPaint());
  18. frame.setSize(600, 600);
  19. frame.setVisible(true);
  20. }
  21.  
  22. public class BioHazardPaint extends JComponent {
  23.  
  24. public void paint(Graphics g) {
  25. int height = 100;
  26. int width = 100;
  27.  
  28. int basex = 200;
  29. int basey = 200;
  30.  
  31. int triangleBaseX = 300;
  32. int triangleBaseY = 50;
  33. int delta = 175;
  34. int h = 280;
  35.  
  36. g.setColor(Color.yellow);
  37. int xpTriangle[] = {triangleBaseX,triangleBaseX+delta,triangleBaseX-delta,triangleBaseX};
  38. int ypTriangle[] = {triangleBaseY,triangleBaseY+h,triangleBaseY+h,triangleBaseY};
  39. g.fillPolygon(xpTriangle, ypTriangle, 4);
  40.  
  41. g.setColor(Color.black);
  42. g.fillOval(basex+3, basey, height, width);
  43. g.fillOval(basex+99-3, basey, height, width);
  44. g.fillOval(basex+50, basey-86+3, height, width);
  45.  
  46. int yellowFactor = 12;
  47.  
  48. g.setColor(Color.yellow);
  49. g.fillOval(basex+2, basey+yellowFactor, height-yellowFactor, width-yellowFactor);
  50. g.fillOval(basex+99+yellowFactor-2, basey+yellowFactor, height-yellowFactor, width-yellowFactor);
  51. g.fillOval(basex+yellowFactor/2+50, basey-86+2, height-yellowFactor, width-yellowFactor);
  52.  
  53. g.setColor(Color.yellow);
  54. g.fillOval(288, 210, 25, 25);
  55.  
  56. g.setColor(Color.yellow);
  57.  
  58. int startx = 300, starty = 218, xyDist = 20;
  59. int endx = startx + xyDist;
  60. int endy = starty + xyDist;
  61. int len = 4;
  62. int xpoints[] = {startx, endx, endx-len, startx-len, startx};
  63. int ypoints[] = {starty, endy, endy+len, starty+len, starty};
  64. int npoints = 5;
  65. g.fillPolygon(xpoints, ypoints, npoints);
  66.  
  67. g.setColor(Color.yellow);
  68. startx = startx+len;
  69. starty = starty+len;
  70. endx = startx - xyDist;
  71. endy = starty + xyDist;
  72. int xpoints2[] = {startx, endx, endx-len, startx-len, startx};
  73. int ypoints2[] = {starty, endy, endy-len, starty-len, starty};
  74. g.fillPolygon(xpoints2, ypoints2, npoints);
  75.  
  76. g.fillRect(298, 200, 5, 15);
  77.  
  78.  
  79. g.setColor(Color.black);
  80.  
  81. int swivels = 80;
  82. int commonx, commony, commonh, commonw;
  83. for(int i=61;i<=swivels;i++){
  84. commonx = 300-i/2;
  85. commony = 222-i/2;
  86. commonh = commonw = i*1;
  87. g.drawArc(commonx, commony, commonh, commonw, 60 , 60);
  88. g.drawArc(commonx, commony, commonh, commonw, 180 , 60);
  89. g.drawArc(commonx, commony, commonh, commonw, 300 , 60);
  90. }
  91.  
  92. }
  93. }
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement