Ejemplo n.º 1
0
  public void paint(Graphics g) {
    g.setColor(Color.pink);

    g.drawRect(40, 40, 80, 80);
    g.drawLine(80, 10, 40, 40);
    g.drawLine(80, 10, 120, 40);
    g.drawRect(70, 80, 20, 40);
  }
Ejemplo n.º 2
0
 public void paint(Graphics g) {
   if (first_paint == 1) {
     g.setColor(new Color(0x0));
     g.fillRect(0, 0, SIZE_X, SIZE_Y);
     g.setColor(new Color(0xffffff));
     g.drawRect(0, 0, SIZE_X - 1, SIZE_Y - 1);
     first_paint = 0;
   }
 }
Ejemplo n.º 3
0
 public static void drawWindows(Graphics g) {
   g.setColor(Color.black);
   g.drawRect(220, 220, 60, 60);
   g.drawLine(220, 250, 280, 250);
   g.drawLine(250, 220, 250, 280);
   g.drawRect(420, 220, 60, 60);
   g.drawLine(420, 250, 480, 250);
   g.drawLine(450, 220, 450, 280);
   g.drawRect(320, 220, 60, 60);
   g.drawLine(320, 250, 380, 250);
   g.drawLine(350, 220, 350, 280);
   g.drawRect(220, 320, 60, 60);
   g.drawLine(220, 350, 280, 350);
   g.drawLine(250, 320, 250, 380);
   g.drawRect(420, 320, 60, 60);
   g.drawLine(420, 350, 480, 350);
   g.drawLine(450, 320, 450, 380);
 }
Ejemplo n.º 4
0
  /*
   *  Draws a frame around the data area.
   */
  protected void drawFrame(Graphics g, int x, int y, int width, int height) {
    Color c = g.getColor();

    if (framecolor != null) g.setColor(framecolor);

    g.drawRect(x, y, width, height);

    g.setColor(c);
  }
Ejemplo n.º 5
0
Archivo: set.java Proyecto: wcyuan/Set
    public void draw(Graphics g, ImageObserver ob) {
      if (!todraw) {
        g.setColor(bgcolor);
        g.drawRect(x, y, w + 2 * border, h + 2 * border);
        g.fillRect(x, y, w + 2 * border, h + 2 * border);
        return;
      }

      if (selected) g.setColor(selected_color);
      else g.setColor(unselected_color);

      g.drawRect(x, y, w + 2 * border, h + 2 * border);
      g.fillRect(x, y, w + 2 * border, h + 2 * border);
      g.drawImage(image[im], x + border, y + border, ob);

      // g.setColor(Color.black);
      // g.drawString("" + im,x+5,y+5);
    }
	public void paint(Graphics g){
		g.setColor(Color.blue);
		setBackground(Color.white);
		g.drawRect(30,30,200,200);
		setBackground(Color.white);
		g.drawString("Hello World, I am an Applet !",50,50);
		g.drawString(s,50,110);
		g.drawString(getParameter("name").toString(),50,70);
		g.drawString(getParameter("myName").toString(),50,100);
		}*/
Ejemplo n.º 7
0
Archivo: set.java Proyecto: wcyuan/Set
  public void paint(Graphics g) {
    Message("Copyright Feb, 2000 Weicon Conan Yuan.", "All Rights Reserved", 7);
    for (int i = 0; i < NUM_LOCATIONS; i++) {
      locs[i].draw(g, this);
      g.setColor(txtcolor);
      if (locs[i].ToDraw()) {
        g.drawString("" + i, locs[i].GetX(), locs[i].GetY() + 10);
      }
    }

    g.setColor(Color.red);
    g.drawRect(400, 200, 30, 30);
    g.fillRect(400, 200, 30, 30);
    Message("Cheat", 4);
  }
Ejemplo n.º 8
0
  public void paint(Graphics g) {
    g.setFont(bigFont);
    g.drawString("Shapes and Colors", 80, 20);

    g.setColor(redColor);

    g.drawRect(100, 100, 100, 100);

    g.fillRect(110, 110, 80, 80);
    g.setColor(weirdColor);
    g.fillArc(120, 120, 60, 60, 0, 360);
    g.setColor(Color.yellow);
    g.drawLine(140, 140, 160, 160);
    g.setColor(Color.black);
  }
Ejemplo n.º 9
0
  public void Draw() {
    Graphics g;
    Color cl;
    int c;
    int xdiff, ydiff;

    g = parentarea.screen;
    if ((Resize) || (ResizeAll)) Calculate_Coors();

    c = ((int) activation) * 255 / 100;
    if (c < 0) c = 0;
    if (c > 255) c = 255;
    cl = new Color(c, c, c);

    if (oldclamp != clamp) {
      g.setColor(Color.white);
      g.fillRect(sx1, sy1, 1 + sx2 - sx1, 1 + sy2 - sy1);
    }

    g.setColor(cl);
    g.fillOval(sx1, sy1, sx2 - sx1, sy2 - sy1);
    g.setColor(Color.black);
    if (activation == (double) 100.0) g.setColor(Color.red);
    g.drawOval(sx1, sy1, sx2 - sx1, sy2 - sy1);

    if (clamp) {
      xdiff = (sx2 - sx1);
      ydiff = (sy2 - sy1);
      g.drawRect(sx1, sy1, xdiff, ydiff);
    }

    if ((Resize) || (ResizeAll)) CalculateSize(g);
    g.setFont(currfont);
    if (activation > 50.0) g.setColor(Color.black);
    else g.setColor(Color.white);
    if (foreground != null) g.setColor(foreground);
    g.drawString(short_name, sx1 + xoff, sy2 - yoff);
    Redraw = false;
    Resize = false;
    if (oldclamp != clamp) {
      // draw all bonds - as they will have been erased
      oldclamp = clamp;
      for (int x = 0; x < outgoing_links.size(); x++) {
        slipnet_link s = (slipnet_link) outgoing_links.elementAt(x);
        s.Draw();
      }
    }
  }
Ejemplo n.º 10
0
 public void paint(Graphics g) {
   int x1 = 30;
   int y1 = 30;
   int x2 = 60;
   int y2 = 50;
   g.drawRect(x1, y1, x2, y2);
   x1 = 80;
   y1 = 80;
   x2 = 100;
   y2 = 100;
   g.drawOval(x1, y1, x2, y2);
   x1 = 200;
   y1 = 60;
   x2 = 60;
   y2 = 60;
   g.drawArc(x1, y1, x2, y2, 0, 180);
 }
Ejemplo n.º 11
0
Archivo: set.java Proyecto: wcyuan/Set
  public void Message(String s, int i) {
    Graphics g = getGraphics();

    if (s == null) {
      g.setColor(bgcolor);
      g.drawRect(400, 50 * i - 10, 200, 10);
      g.fillRect(400, 50 * i - 10, 200, 10);
      return;
    }
    /*
      g.setColor(Color.blue);
      g.drawRect(400,50 * i - 10,200,10);
      g.fillRect(400,50 * i - 10,200,10);
    */
    g.setColor(txtcolor);
    g.drawString(s, 400, 50 * i);
  }
Ejemplo n.º 12
0
  public void paint(Graphics g) {
    panel_height = size().height;
    int w = size().width;

    for (int i = 0; i < nsticks; i++) {
      sticks[i].setY(panel_height - bottom_offset);
      sticks[i].paintStick(g);
      if (i == pivot) {
        g.setColor(Color.black);
        drawVertArrow(g, sticks[i].x + 5, 20, sticks[i].x + 5, sticks[i].y - sticks[i].h - 5);
        g.drawString("Pivot", sticks[i].x - 10, 15);
      }
      if (i == currentLocation) {
        g.setColor(Color.blue);
        drawVertArrow(
            g,
            sticks[i].x + sticks[i].w / 2,
            60,
            sticks[i].x + sticks[i].w / 2,
            sticks[i].y - sticks[i].h - 5);
        g.drawString("i", sticks[i].x + sticks[i].w / 2 - 2, 55);
      }
      if (i == p_pos) {
        g.setColor(Color.magenta);
        drawVertArrow(
            g,
            sticks[i].x + sticks[i].w - 5,
            40,
            sticks[i].x + sticks[i].w - 5,
            sticks[i].y - sticks[i].h - 5);
        g.drawString("p_pos", sticks[i].x + sticks[i].w - 8, 35);
      }
    }

    g.setColor(Color.black);
    g.drawRect(1, 1, w - 2, panel_height - 2);
  } // paint()
Ejemplo n.º 13
0
  public void paint(Graphics g) {

    // double p = 1000;
    // double m = 100;
    double nr = r / 12;
    double b = 0;
    int v = 0;
    g.setColor(new Color(255, 255, 255));
    g.fillRect(0, 0, 500, 300);

    g.setColor(new Color(0, 0, 255));
    g.drawRect(0, 10, 400, 210);
    g.drawLine(0, 50, 400, 50);
    g.drawLine(0, 85, 400, 85);
    g.drawLine(0, 120, 400, 120);
    g.drawLine(0, 155, 400, 155);
    g.drawLine(0, 190, 400, 190);

    g.setColor(new Color(0, 0, 0));
    g.drawString("INITIAL INVESTMENT = $" + p, 20, 50);
    g.drawString("MONTHY INVESTMENT = $" + m, 20, 85);
    g.drawString("INTEREST RATE = " + r, 20, 120);
    g.drawString("YEARS OF INVESTMENT = " + y, 20, 155);

    double n = 0;
    b = p;
    while (n < (y * 12)) {
      b = (b * (1 + nr)) + m;

      n++;
    }
    n = 0;
    v = (int) b;
    g.setColor(new Color(255, 0, 0));
    g.drawString("ENDING BALANCE= $" + v, 20, 190);
  } // end paint
Ejemplo n.º 14
0
  public void paint(Graphics g) {
    // clears the area that the pannel is on
    gBuffer.setColor(Color.white);
    gBuffer.fillRect(0, 0, 65, 415);

    // pannel
    gBuffer.setColor(Color.black);
    gBuffer.drawRect(5, 15, 60, 400);

    // color buttons
    gBuffer.setColor(Color.black); // first column
    gBuffer.fillRect(15, 20, 20, 20);
    gBuffer.setColor(Color.red);
    gBuffer.fillRect(15, 40, 20, 20);
    gBuffer.setColor(Color.blue);
    gBuffer.fillRect(15, 60, 20, 20);
    gBuffer.setColor(Color.green);
    gBuffer.fillRect(15, 80, 20, 20);
    gBuffer.setColor(Color.yellow);
    gBuffer.fillRect(15, 100, 20, 20);
    gBuffer.setColor(Color.gray); // second column
    gBuffer.fillRect(35, 20, 20, 20);
    gBuffer.setColor(Color.magenta);
    gBuffer.fillRect(35, 40, 20, 20);
    gBuffer.setColor(Color.cyan);
    gBuffer.fillRect(35, 60, 20, 20);
    gBuffer.setColor(Color.orange);
    gBuffer.fillRect(35, 80, 20, 20);
    gBuffer.setColor(Color.pink);
    gBuffer.fillRect(35, 100, 20, 20);
    gBuffer.setColor(Color.black); // draw first column button outlines
    gBuffer.drawRect(15, 20, 20, 20);
    gBuffer.drawRect(15, 40, 20, 20);
    gBuffer.drawRect(15, 60, 20, 20);
    gBuffer.drawRect(15, 80, 20, 20);
    gBuffer.drawRect(15, 100, 20, 20);
    gBuffer.fillRect(15, 20, 20, 20);
    gBuffer.drawRect(35, 20, 20, 20); // draw second column button outlines
    gBuffer.drawRect(35, 40, 20, 20);
    gBuffer.drawRect(35, 60, 20, 20);
    gBuffer.drawRect(35, 80, 20, 20);
    gBuffer.drawRect(35, 100, 20, 20);

    // pen button design
    gBuffer.setColor(Color.black);
    gBuffer.drawRect(23, 125, 3, 20);
    penta = new Polygon();
    penta.addPoint(23, 145);
    penta.addPoint(26, 145);
    penta.addPoint(25, 148);
    gBuffer.drawPolygon(penta);

    // brush button design
    gBuffer.setColor(Color.gray);
    gBuffer.fillRect(45, 128, 3, 10);
    penta = new Polygon();
    penta.addPoint(45, 138);
    penta.addPoint(48, 138);
    penta.addPoint(51, 141);
    penta.addPoint(42, 141);
    gBuffer.drawPolygon(penta);
    gBuffer.setColor(Color.black);
    gBuffer.drawRect(42, 141, 9, 5);
    gBuffer.drawLine(45, 146, 45, 144);
    gBuffer.drawLine(48, 146, 48, 143);

    // roller button design
    gBuffer.setColor(Color.black); // handle
    gBuffer.fillRect(23, 155, 3, 10);
    gBuffer.drawRect(19, 165, 9, 4);
    gBuffer.setColor(Color.white); // roller front
    gBuffer.fillOval(27, 166, 4, 4);
    gBuffer.setColor(Color.black); // roller round side
    gBuffer.drawOval(27, 166, 3, 3);

    // spray paint button design
    gBuffer.setColor(Color.black); // top of can
    penta = new Polygon();
    penta.addPoint(43, 156);
    penta.addPoint(48, 160);
    penta.addPoint(43, 163);
    gBuffer.drawPolygon(penta);
    gBuffer.setColor(Color.blue); // spray button
    gBuffer.fillRect(42, 155, 2, 3);
    for (int n = 0; n <= 20; n++) // paint spray
    {
      x = 39 + ((int) (3 * Math.cos((rnd.nextDouble() * 2 * Math.PI))));
      y = 157 + ((int) (3 * Math.sin((rnd.nextDouble() * 2 * Math.PI))));
      gBuffer.fillRect(x, y, 1, 1);
    }
    penta = new Polygon(); // can
    penta.addPoint(43, 163);
    penta.addPoint(48, 160);
    penta.addPoint(53, 172);
    penta.addPoint(48, 177);
    gBuffer.fillPolygon(penta);
    gBuffer.setColor(Color.black);
    gBuffer.drawPolygon(penta);

    // rubber band drawing button design (20,185,30,205);
    gBuffer.setColor(Color.black);
    for (int a = 18, b = 200; a <= 35; a += 4, b += 2) {
      gBuffer.drawLine(18, 183, a, b);
    }

    // eraser button design
    gBuffer.setColor(Color.yellow); // top
    penta = new Polygon();
    penta.addPoint(45, 185);
    penta.addPoint(50, 185);
    penta.addPoint(45, 200);
    penta.addPoint(40, 200);
    gBuffer.fillPolygon(penta);
    gBuffer.setColor(Color.black); // outline
    gBuffer.drawPolygon(penta);
    gBuffer.setColor(Color.yellow); // side
    penta = new Polygon();
    penta.addPoint(50, 185);
    penta.addPoint(45, 200);
    penta.addPoint(48, 204);
    penta.addPoint(52, 189);
    gBuffer.fillPolygon(penta);
    gBuffer.setColor(Color.black); // outline
    gBuffer.drawPolygon(penta);
    penta = new Polygon(); // front
    penta.addPoint(40, 200);
    penta.addPoint(45, 200);
    penta.addPoint(48, 204);
    penta.addPoint(43, 204);
    gBuffer.drawPolygon(penta);

    // clear button design
    gBuffer.setColor(Color.black);
    gBuffer.setFont(new Font("Arial", Font.BOLD, 20));
    gBuffer.drawString("Clear", 10, 239);
    gBuffer.drawRect(10, 220, 50, 25);

    gBuffer.setColor(Color.cyan);
    switch (numSize) {
      case 1:
        gBuffer.drawRect(15, 120, 20, 30);
        break;
      case 2:
        gBuffer.drawRect(35, 120, 20, 30);
        break;
      case 3:
        gBuffer.drawRect(15, 150, 20, 30);
        break;
      case 4:
        gBuffer.drawRect(35, 150, 20, 30);
        break;
      case 5:
        gBuffer.drawRect(15, 180, 20, 30);
        break;
      case 6:
        gBuffer.drawRect(35, 180, 20, 30);
        break;
    }

    if ((numSize == 4) || (numSize == 6)) {
      // draw different size buttons for spray paint, eraser, and rubber band
      gBuffer.setColor(Color.white);
      gBuffer.fillRect(20, 265, 35, 75);
      gBuffer.setColor(Color.cyan);
      switch (size) {
        case 1:
          gBuffer.drawRect(26, 271, 18, 18);
          break;
        case 2:
          gBuffer.drawRect(26, 291, 18, 18);
          break;
        case 3:
          gBuffer.drawRect(26, 311, 18, 18);
      }
      gBuffer.setColor(Color.black);
      gBuffer.drawRect(20, 265, 30, 70); // size pannel
      gBuffer.drawRect(25, 270, 20, 20); // small
      gBuffer.drawRect(25, 290, 20, 20); // medium
      gBuffer.drawRect(25, 310, 20, 20); // large

      if (numSize == 4) {
        for (int n = 0; n <= 20; n++) {
          x = 35 + ((int) (4 * Math.cos((rnd.nextDouble() * 2 * Math.PI))));
          y = 280 + ((int) (4 * Math.sin((rnd.nextDouble() * 2 * Math.PI))));
          gBuffer.fillRect(x, y, 1, 1);
        }
        for (int n = 0; n <= 40; n++) {
          x = 34 + ((int) (6 * Math.cos((rnd.nextDouble() * 2 * Math.PI))));
          y = 300 + ((int) (6 * Math.sin((rnd.nextDouble() * 2 * Math.PI))));
          gBuffer.fillRect(x, y, 1, 1);
        }
        for (int n = 0; n <= 70; n++) {
          x = 35 + ((int) (8 * Math.cos((rnd.nextDouble() * 2 * Math.PI))));
          y = 319 + ((int) (8 * Math.sin((rnd.nextDouble() * 2 * Math.PI))));
          gBuffer.fillRect(x, y, 1, 1);
        }
        switch (size) {
          case 1:
            s = 4;
            break;
          case 2:
            s = 6;
            break;
          case 3:
            s = 8;
        }
      } else if (numSize == 6) {
        gBuffer.drawRect(33, 278, 4, 4);
        gBuffer.drawRect(32, 297, 7, 7);
        gBuffer.drawRect(30, 315, 10, 10);

        switch (size) {
          case 1:
            s = 4;
            break;
          case 2:
            s = 7;
            break;
          case 3:
            s = 10;
        }
      }
    } else {
      gBuffer.setColor(Color.white);
      gBuffer.fillRect(20, 265, 35, 75);
    }

    // draw pannel and buttons
    g.drawImage(virtualMem, 0, 0, this);

    // changing what color it draws with
    switch (numColor) {
      case 1:
        gBuffer.setColor(Color.black);
        break;
      case 2:
        gBuffer.setColor(Color.red);
        break;
      case 3:
        gBuffer.setColor(Color.blue);
        break;
      case 4:
        gBuffer.setColor(Color.green);
        break;
      case 5:
        gBuffer.setColor(Color.yellow);
        break;
      case 6:
        gBuffer.setColor(Color.gray);
        break;
      case 7:
        gBuffer.setColor(Color.magenta);
        break;
      case 8:
        gBuffer.setColor(Color.cyan);
        break;
      case 9:
        gBuffer.setColor(Color.orange);
        break;
      case 10:
        gBuffer.setColor(Color.pink);
        break;
      case 11:
        gBuffer.setColor(Color.white);
        break;
      default:
        gBuffer.setColor(Color.black);
    }

    // changing how it draws
    switch (numDraw) {
      case 1: // clear drawing
        gBuffer.setColor(Color.white);
        gBuffer.fillRect(0, 0, appletWidth, appletHeight);
        g.drawImage(virtualMem, 0, 0, this);
        numDraw = 0;
        repaint();
        break;
      default:
        switch (numSize) {
          case 1: // draw with pen
            if (!first) {
              gBuffer.drawLine(oldX, oldY, newX, newY);
              g.drawImage(virtualMem, 0, 0, this);
            } else first = false;
            break;
          case 2: // draw with brush
            if (!first) {
              gBuffer.fillRect(oldX, oldY, 4, 4);
              g.drawImage(virtualMem, 0, 0, this);
            } else first = false;
            break;
          case 3: // draw with roller
            if (!first) {
              gBuffer.fillRect(oldX, oldY, 10, 10);
              g.drawImage(virtualMem, 0, 0, this);
            } else first = false;
            break;
          case 4: // draw with spray paint
            if (!first) {
              for (int n = 0; n <= 20; n++) {
                x = oldX + ((int) (s * Math.cos((rnd.nextDouble() * 2 * Math.PI))));
                y = oldY + ((int) (s * Math.sin((rnd.nextDouble() * 2 * Math.PI))));
                gBuffer.fillRect(x, y, 1, 1);
                g.drawImage(virtualMem, 0, 0, this);
              }
            } else first = false;

            break;
          case 5: // draw with rubber band style
            if (!first) {
              gBuffer.drawLine(startX, startY, endX, endY);
              g.drawImage(virtualMem, 0, 0, this);
            } else first = false;
            break;
          case 6: // eraser drawer
            if (!first) {
              gBuffer.fillRect(oldX, oldY, s, s);
              g.drawImage(virtualMem, 0, 0, this);
            } else first = false;
            break;
          default: // default to drawing with pen
            if (!first) {
              gBuffer.drawLine(oldX, oldY, newX, newY);
              g.drawImage(virtualMem, 0, 0, this);
            } else first = false;
        }
    }
  }
Ejemplo n.º 15
0
  public void paint(Graphics g) {

    // Draw Grid
    g.drawRect(10, 10, 780, 580);
    g.drawLine(400, 10, 400, 590);
    g.drawLine(10, 300, 790, 300);

    Random rnd = new Random(1234);
    for (int k = 10; k <= 400; k += 10) { // The first box lines
      g.drawLine(k, 20, k, 290);
    } // The dimentions of the lines
    for (int k = 10; k <= 290; k += 10) { // The second box lines
      g.drawLine(420, k, 770, k); // The dimestions
      int red = rnd.nextInt(256); // The colors
      int green = rnd.nextInt(256);
      int blue = rnd.nextInt(256);
      g.setColor(new Color(red, green, blue)); // The randomness of colors
    }
    for (int k = 1; k <= 100; k++) { // The 3rd circles
      int x = rnd.nextInt(330); // the random of x lo
      int y = rnd.nextInt(230); // the randm of y
      int red = rnd.nextInt(256); // the random of colors
      int green = rnd.nextInt(256);
      int blue = rnd.nextInt(256);
      g.setColor(new Color(red, green, blue));
      g.fillOval(x + 10, y + 300, 50, 50);
    } // the place of all the ovals

    Polygon side1 = new Polygon(); // blue side of cube
    side1.addPoint(600, 410);
    side1.addPoint(635, 410);
    side1.addPoint(635, 480);
    side1.addPoint(600, 445);
    g.setColor(Color.blue);
    g.fillPolygon(side1);
    Polygon side2 = new Polygon(); // green side of cube
    side2.addPoint(510, 380);
    side2.addPoint(550, 410);
    side2.addPoint(550, 495);
    side2.addPoint(510, 455);
    g.setColor(Color.green);
    g.fillPolygon(side2);
    Polygon side3 = new Polygon(); // yellow side of cube
    side3.addPoint(550, 445);
    side3.addPoint(600, 445);
    side3.addPoint(635, 480);
    side3.addPoint(550, 495);
    g.setColor(Color.yellow);
    g.fillPolygon(side3);
    Polygon side4 = new Polygon(); // red side of cube
    side4.addPoint(510, 380);
    side4.addPoint(550, 410);
    side4.addPoint(635, 410);
    side4.addPoint(600, 380);
    g.setColor(Color.red);
    g.fillPolygon(side4);
    // TODO Auto-generated method stub

    // TODO Auto-generated method stub

  }
Ejemplo n.º 16
0
 public static void drawFloors(Graphics g) {
   g.setColor(Color.blue);
   g.drawRect(200, 200, 300, 100);
   g.drawRect(200, 300, 300, 100);
 }
Ejemplo n.º 17
0
  public void paint(Graphics g) {
    // Draw Grid
    g.drawRect(0, 0, 780, 580);
    g.drawLine(400, 0, 400, 580);
    g.drawLine(0, 300, 780, 300);

    Random rndInt = new Random(1234);

    // Draw Random Squares

    for (int k = 1; k <= 1000; k++) {
      int x = rndInt.nextInt(385);
      int y = rndInt.nextInt(275);
      int red = rndInt.nextInt(256);
      int green = rndInt.nextInt(120);
      int blue = rndInt.nextInt(120);
      g.setColor(new Color(red, green, blue));
      g.fillRect(x, y, 15, 15);
    }
    // Draw Random Lines

    for (int k = 1; k <= 1000; k++) {
      int x1 = rndInt.nextInt(350);
      int y1 = rndInt.nextInt(300);
      int x2 = rndInt.nextInt(370);
      int y2 = rndInt.nextInt(300);
      g.drawLine(x1 + 400, y1, x2 + 400, y2);
      int red = rndInt.nextInt(100);
      int green = rndInt.nextInt(100);
      int blue = rndInt.nextInt(100);
      g.setColor(new Color(red, green, blue));
    }

    // Draw Random Circles
    for (int k = 1; k <= 1000; k++) {
      int x3 = rndInt.nextInt(385);
      int y3 = rndInt.nextInt(272);
      int red = rndInt.nextInt(240);
      int green = rndInt.nextInt(255);
      int blue = rndInt.nextInt(255);
      g.setColor(new Color(red, green, blue));
      g.drawOval(x3, y3 + 300, 11, 11);
    }
    // Draw 3-D Box
    {
      g.setColor(Color.blue);
      int x[] = {575, 675, 675, 575};
      int y[] = {425, 425, 525, 525};
      g.drawPolygon(x, y, 4);
      g.fillPolygon(x, y, 4);
    }
    {
      g.setColor(Color.yellow);
      int x1[] = {525, 575, 575, 525};
      int y1[] = {375, 425, 525, 475};
      g.drawPolygon(x1, y1, 4);
      g.fillPolygon(x1, y1, 4);
    }
    {
      g.setColor(Color.green);
      int x2[] = {525, 625, 625, 575};
      int y2[] = {375, 375, 425, 425};
      g.drawPolygon(x2, y2, 4);
      g.fillPolygon(x2, y2, 4);
    }
    {
      g.setColor(Color.red);
      int x3[] = {625, 625, 675};
      int y3[] = {375, 425, 425};
      g.drawPolygon(x3, y3, 3);
      g.fillPolygon(x3, y3, 3);
    }
  }
Ejemplo n.º 18
0
 public static void drawDoor(Graphics g) {
   g.setColor(Color.black);
   g.drawRect(330, 340, 40, 60);
   g.drawOval(340, 350, 20, 40);
   g.fillOval(364, 370, 5, 5);
 }