Package java.awt

Examples of java.awt.Graphics.drawRect()


    final Graphics graphics = gfx.create();
    graphics.setColor(value);
    graphics.fillRect(box.x, box.y, box.width, box.height);
    graphics.setColor(Color.BLACK);
    graphics.drawRect(box.x, box.y, box.width, box.height);
    graphics.dispose();
  }

  public String getJavaInitializationString()
  {
View Full Code Here


    Random random = new Random();
    Graphics g = image.getGraphics();
    g.setColor(getRandColor(200, 250));
    g.fillRect(1, 1, width - 1, height - 1);
    g.setColor(new Color(102, 102, 103));
    g.drawRect(0, 0, width - 1, height - 1);
    g.setFont(font);
    // 随机生成线条,让图片看起来更加杂乱
    g.setColor(getRandColor(160, 200));
    for (int i = 0; i < 155; i++) {
      int x = random.nextInt(width - 1);
View Full Code Here

            final Graphics pg = job.getGraphics();
            final Dimension pageSize = job.getPageDimension();

            if (pg != null) {
                pg.translate(LEFT, HEIGHT);
                pg.drawRect(0, 0, pageSize.width - LEFT - 1, pageSize.height - HEIGHT - 1);
                view.print(new PrintCanvas(pg, view));
                pg.dispose();
            }

            job.end();
View Full Code Here

                graphic.setFont(TITLE_FONT);

                final int height = graphic.getFontMetrics().getAscent();
                final int width = graphic.getFontMetrics().stringWidth(title);
                graphic.drawRect(x - 10, y - 10 - height, width + 20, height + 20);

                graphic.drawString(title, x, y);

                y += graphic.getFontMetrics().getHeight();
                y += 20;
View Full Code Here

            }
        } else if (end) {
            g2.setColor(Color.BLACK);
            g2.fillRect(2 * CELL, 9 * CELL, 8 * CELL, 4 * CELL);
            g2.setColor(Color.WHITE);
            g2.drawRect(2 * CELL, 9 * CELL, 8 * CELL, 4 * CELL);
            g2.drawString("GAME OVER! SCORE: " + score, (WIDTH_C - 6) * CELL / 2 + 2,
                (HEIGHT_C + 2) * CELL / 2);
        }
        g2.dispose();
        g.drawImage(img, 0, 0, this);
View Full Code Here

    if (dragRect != null)
    {
      // System.out.println("drawing: " + dragRect.toString());
      graphics.setColor(Color.black);
      graphics.drawRect(dragRect.x, dragRect.y, dragRect.width,
          dragRect.height);
    }
  }

  public void kludgyMultiDimensionalDraw(int x, int y, int w, int h,
View Full Code Here

    currHeight = height;

    if (dragRect != null)
    {
      graphics.setColor(Color.black);
      graphics.drawRect(dragRect.x, dragRect.y, dragRect.width,
          dragRect.height);
    }
  }

  public Vector getChunkVisInfosForPoint(Point p)
View Full Code Here

    if (dragRect != null)
    {
      // System.out.println("drawing: " + dragRect.toString());
      graphics.setColor(Color.black);
      graphics.drawRect(dragRect.x, dragRect.y, dragRect.width,
          dragRect.height);
    }

    currXMulti = xMulti;
    currHeight = height;
View Full Code Here

    final Graphics graphics = gfx.create();
    graphics.setColor(value);
    graphics.fillRect(box.x, box.y, box.width, box.height);
    graphics.setColor(Color.BLACK);
    graphics.drawRect(box.x, box.y, box.width, box.height);
    graphics.dispose();
  }

  public String getJavaInitializationString()
  {
View Full Code Here

            } else {
                g.setColor(Color.lightGray);
            }
            g.fillRect(0, y, 10, steps);
            g.setColor(Color.black);
            g.drawRect(0, y, 10, steps);
        }
    }
}
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.