Package java.awt

Examples of java.awt.Graphics.fillRect()


        BufferedImage myImage =
          new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
        Graphics g = myImage.getGraphics();
        g.setColor(Color.WHITE);
        g.fillRect(0, 0, w, h);

        int width = image.getWidth();
        int height = image.getHeight();

        if (width > height) {
View Full Code Here


        BufferedImage myImage =
          new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
        Graphics g = myImage.getGraphics();
        g.setColor(Color.WHITE);
        g.fillRect(0, 0, w, h);

        int width = image.getWidth();
        int height = image.getHeight();

        if (width > height) {
View Full Code Here

        else                          g.drawLine(px, py, px + 10, py);
        GraphicsUtil.switchToWidth(g, 1);
      }
     
      g.setColor(color);
      g.fillRect(x, y, w - DEPTH, h - DEPTH);
      g.setColor(Color.BLACK);
      g.drawRect(x, y, w - DEPTH, h - DEPTH);
    } else {
      depress = 0;
      int[] xp = new int[] { x, x + w - DEPTH, x + w, x + w, x + DEPTH, x };
View Full Code Here

      int[] xp = new int[] { x, x + w - DEPTH, x + w, x + w, x + DEPTH, x };
      int[] yp = new int[] { y, y, y + DEPTH, y + h, y + h, y + h - DEPTH };
      g.setColor(color.darker());
      g.fillPolygon(xp, yp, xp.length);
      g.setColor(color);
      g.fillRect(x, y, w - DEPTH, h - DEPTH);
      g.setColor(Color.BLACK);
      g.drawRect(x, y, w - DEPTH, h - DEPTH);
      g.drawLine(x + w - DEPTH, y + h - DEPTH, x + w, y + h);
      g.drawPolygon(xp, yp, xp.length);
    }
View Full Code Here

      BufferedImage img = new BufferedImage(width, height,
          BufferedImage.TYPE_INT_RGB);
      Graphics base = img.getGraphics();
      Graphics g = base.create();
      g.setColor(Color.white);
      g.fillRect(0, 0, width, height);
      g.setColor(Color.black);
      if (g instanceof Graphics2D) {
        ((Graphics2D) g).scale(scale, scale);
        ((Graphics2D) g).translate(-bds.getX(), -bds.getY());
      } else {
View Full Code Here

  }

  @Override
  public void paintIcon(ComponentDrawContext c, int x, int y) {
    Graphics g = c.getGraphics();
    g.fillRect(x + 2, y + 1, 9, 2);
    g.drawRect(x + 2, y + 3, 15, 12);
    g.setColor(Color.lightGray);
    g.drawLine(x + 4, y + 2, x + 8, y + 2);
    for (int y_offs = y + 6; y_offs < y + 15; y_offs += 3) {
      g.drawLine(x + 4, y_offs, x + 14, y_offs);
View Full Code Here

          if (val == Value.TRUE) c = onColor;
          else if (val == Value.FALSE) c = offColor;
          else c = Value.ERROR_COLOR;
          g.setColor(c);
         
          if (drawSquare) g.fillRect(x, y, 10, 10);
          else g.fillOval(x + 1, y + 1, 8, 8);
        } else {
          g.setColor(Color.GRAY);
          g.fillOval(x + 1, y + 1, 8, 8);
        }
View Full Code Here

    Color onColor = painter.getAttributeValue(Io.ATTR_ON_COLOR);
    Color offColor = painter.getAttributeValue(Io.ATTR_OFF_COLOR);
    Color bgColor = painter.getAttributeValue(Io.ATTR_BACKGROUND);
    if (painter.shouldDrawColor() && bgColor.getAlpha() != 0) {
      g.setColor(bgColor);
      g.fillRect(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight());
      g.setColor(Color.BLACK);
    }
    painter.drawBounds();
    g.setColor(Color.DARK_GRAY);
    for (int i = 0; i <= 7; i++) {
View Full Code Here

      if (painter.getShowState()) {
        g.setColor(((summ >> i) & 1) == desired ? onColor : offColor);
      }
      if (i < 7) {
        Bounds seg = SEGMENTS[i];
        g.fillRect(x + seg.getX(), y + seg.getY(), seg.getWidth(), seg.getHeight());
      } else {
        g.fillOval(x + 28, y + 48, 5, 5); // draw decimal point
      }
    }
    painter.drawPorts();
View Full Code Here

      Location loc = painter.getLocation();
      int x = loc.getX();
      int y = loc.getY();
      Graphics g = painter.getGraphics();
      g.setColor(Color.WHITE);
      g.fillRect(x - 20, y, 10, 10);
      GraphicsUtil.switchToWidth(g, 3);
      g.setColor(Color.BLACK);
      int dx = state.xPos;
      int dy = state.yPos;
      int x0 = x - 15 + (dx > 5 ? 1 : dx < -5 ? -1 : 0);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.