Package java.awt

Examples of java.awt.Graphics.fillRect()


            ourImageCache.put(new Integer(myPageIndex), bufferImage);
          }
            Graphics bufferGraphics = bufferImage.getGraphics();
            {
              bufferGraphics.setColor(Color.white);
              bufferGraphics.fillRect(0, 0, bufferImage.getWidth(), bufferImage.getHeight());
              try {
          myChart.print(bufferGraphics, myPageFormat, myPageIndex);
        } catch (PrinterException e) {
              if (!GPLogger.log(e)) {
                e.printStackTrace(System.err);
View Full Code Here


    if (memImage==null) return; //Called before added to visible frame
    Graphics memG  = memImage.getGraphics();
   
    // Set background
    memG.setColor(getBackground());
    memG.fillRect(0,0,d.width,d.height);

    memG.setColor(txtColor);
   
    String s = msg;
    if(bShowPerc) {
View Full Code Here

      for(int x = x0; x < xmax; x = x + block + pad) {
  double k = (x - x0) / (double)diff;
  Color c = Util.rgbInterpolate(lowColor, highColor, k);
  memG.setColor(c);
 
  memG.fillRect(x, 3, block, h - 6);
      }
    } else {
      int trail = diff / 3;
      if(delta > 0) {
  int xstart = xmax - trail;
View Full Code Here

  if(xstart < x0) xstart = x0;
  for(int x = xstart; x < xmax; x++) {
    double k = (x - xstart) / (double)trail;
    Color c = Util.rgbInterpolate(getBackground(), highColor, k);
    memG.setColor(c);
    memG.fillRect(x, 3, 1, h - 6);
  }
      } else if(delta < 0) {
  int xend = xmax + trail;
  if(xend > x1) xend = x1;
  for(int x = xend; x > xmax; x--) {
View Full Code Here

  if(xend > x1) xend = x1;
  for(int x = xend; x > xmax; x--) {
    double k = (xend - x) / (double)trail;
    Color c = Util.rgbInterpolate(getBackground(), highColor, k);
    memG.setColor(c);
    memG.fillRect(x, 3, 1, h - 6);
  }
      }
    }
   
    // Copy image to canvas
View Full Code Here

      final Rectangle2D rect = g.getFontMetrics().getStringBounds(title, g);
      int w = (int) rect.getWidth() + 1;
      titleImage = getGraphicsConfiguration().createCompatibleImage(w, TITLE_HEIGHT, Transparency.OPAQUE);
      Graphics ig = titleImage.getGraphics();
      ig.setColor(Color.BLACK);
      ig.fillRect(0, 0, w, TITLE_HEIGHT);
      ig.setColor(Color.WHITE);
      ig.drawString(title, 0, TITLE_HEIGHT - 3);
      ig.dispose();
    }
    int startX = Math.max(0, (width - titleImage.getWidth(null)) / 2);
View Full Code Here

    GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    // create the map image, and fill it with the wanted details
    final Image newMapImage  = gc.createCompatibleImage(mapWidth * scale, mapHeight * scale);
    final Graphics g = newMapImage.getGraphics();
    g.setColor(COLOR_BACKGROUND);
    g.fillRect(0, 0, mapWidth * scale, mapHeight * scale);
   
    for (int x = 0; x < mapWidth; x++) {
      for (int y = 0; y < mapHeight; y++) {
        if (cd.collides(x, y)) {
          g.setColor(COLOR_BLOCKED);
View Full Code Here

   
    for (int x = 0; x < mapWidth; x++) {
      for (int y = 0; y < mapHeight; y++) {
        if (cd.collides(x, y)) {
          g.setColor(COLOR_BLOCKED);
          g.fillRect(x * scale, y * scale, scale, scale);
        } else if (pd != null && pd.collides(x, y)) {
          // draw protection only if there is no collision to draw
          g.setColor(COLOR_PROTECTION);
          g.fillRect(x * scale, y * scale, scale, scale);
        }
View Full Code Here

          g.setColor(COLOR_BLOCKED);
          g.fillRect(x * scale, y * scale, scale, scale);
        } else if (pd != null && pd.collides(x, y)) {
          // draw protection only if there is no collision to draw
          g.setColor(COLOR_PROTECTION);
          g.fillRect(x * scale, y * scale, scale, scale);
        }
      }
    }
    g.dispose();

View Full Code Here

   */
  private static Icon createMinimizeIcon(Image image) {
    Graphics g = image.getGraphics();

    g.setColor(Color.BLACK);
    g.fillRect(1, TITLEBAR_HEIGHT - 3, TITLEBAR_HEIGHT - 2, 2);
   
    return new ImageIcon(image);
  }
 
  /**
 
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.