Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import java.awt.Color;
- import java.awt.Graphics;
- import javax.swing.JComponent;
- import javax.swing.JFrame;
- public class BioHazardReal {
- public static void main(String[] args) {
- new BioHazardReal();
- }
- public BioHazardReal() {
- JFrame frame = new JFrame("Biohazard");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().add(new BioHazardPaint());
- frame.setSize(600, 600);
- frame.setVisible(true);
- }
- public class BioHazardPaint extends JComponent {
- public void paint(Graphics g) {
- int height = 100;
- int width = 100;
- int basex = 200;
- int basey = 200;
- int triangleBaseX = 300;
- int triangleBaseY = 50;
- int delta = 175;
- int h = 280;
- g.setColor(Color.yellow);
- int xpTriangle[] = {triangleBaseX,triangleBaseX+delta,triangleBaseX-delta,triangleBaseX};
- int ypTriangle[] = {triangleBaseY,triangleBaseY+h,triangleBaseY+h,triangleBaseY};
- g.fillPolygon(xpTriangle, ypTriangle, 4);
- g.setColor(Color.black);
- g.fillOval(basex+3, basey, height, width);
- g.fillOval(basex+99-3, basey, height, width);
- g.fillOval(basex+50, basey-86+3, height, width);
- int yellowFactor = 12;
- g.setColor(Color.yellow);
- g.fillOval(basex+2, basey+yellowFactor, height-yellowFactor, width-yellowFactor);
- g.fillOval(basex+99+yellowFactor-2, basey+yellowFactor, height-yellowFactor, width-yellowFactor);
- g.fillOval(basex+yellowFactor/2+50, basey-86+2, height-yellowFactor, width-yellowFactor);
- g.setColor(Color.yellow);
- g.fillOval(288, 210, 25, 25);
- g.setColor(Color.yellow);
- int startx = 300, starty = 218, xyDist = 20;
- int endx = startx + xyDist;
- int endy = starty + xyDist;
- int len = 4;
- int xpoints[] = {startx, endx, endx-len, startx-len, startx};
- int ypoints[] = {starty, endy, endy+len, starty+len, starty};
- int npoints = 5;
- g.fillPolygon(xpoints, ypoints, npoints);
- g.setColor(Color.yellow);
- startx = startx+len;
- starty = starty+len;
- endx = startx - xyDist;
- endy = starty + xyDist;
- int xpoints2[] = {startx, endx, endx-len, startx-len, startx};
- int ypoints2[] = {starty, endy, endy-len, starty-len, starty};
- g.fillPolygon(xpoints2, ypoints2, npoints);
- g.fillRect(298, 200, 5, 15);
- g.setColor(Color.black);
- int swivels = 80;
- int commonx, commony, commonh, commonw;
- for(int i=61;i<=swivels;i++){
- commonx = 300-i/2;
- commony = 222-i/2;
- commonh = commonw = i*1;
- g.drawArc(commonx, commony, commonh, commonw, 60 , 60);
- g.drawArc(commonx, commony, commonh, commonw, 180 , 60);
- g.drawArc(commonx, commony, commonh, commonw, 300 , 60);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement