Package java.awt

Examples of java.awt.Graphics2D.fillRect()


                        protected void paintComponent(Graphics g) {
                            Graphics2D g2d = (Graphics2D) g.create();
                            g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
                            g2d.setColor(Color.BLACK);
                            g2d.fillRect(0, 0, getWidth(), getHeight());
                            g2d.dispose();
                        }
                    };
                    player.setPreferredSize(new Dimension(400, 250));
                    player.setControlsVisible(true);
View Full Code Here


      Graphics2D g = createGraphics(bi);
      Color backcolor = getBackcolor();
      if (backcolor != null)
      {
        g.setColor(backcolor);
        g.fillRect(0, 0, (int)dimension.getWidth(), (int)dimension.getHeight());
      }
      render(g, new Rectangle((int)dimension.getWidth(), (int)dimension.getHeight()));
      g.dispose();
     
      return JRImageLoader.loadImageDataFromAWTImage(bi, getImageType());
View Full Code Here

      int composite = AlphaComposite.DST;
      graphics.setComposite(AlphaComposite.getInstance(composite));
      Color c = new Color(bgColor.getRed(), bgColor.getGreen(), bgColor.getBlue(), 0);
      graphics.setBackground(bgColor);
      graphics.setColor(c);
      graphics.fillRect(0, 0, image.getWidth(), image.getHeight());
      composite = AlphaComposite.DST_OVER;
      graphics.setComposite(AlphaComposite.getInstance(composite));
    } else {
      graphics.setColor(bgColor);
      graphics.fillRect(0, 0, image.getWidth(), image.getHeight());
View Full Code Here

      graphics.fillRect(0, 0, image.getWidth(), image.getHeight());
      composite = AlphaComposite.DST_OVER;
      graphics.setComposite(AlphaComposite.getInstance(composite));
    } else {
      graphics.setColor(bgColor);
      graphics.fillRect(0, 0, image.getWidth(), image.getHeight());
    }
    if (renderingHints != null) {
      graphics.setRenderingHints(renderingHints);
    }
    return graphics;
View Full Code Here

    public void paintComponent(Graphics gc) {
        Graphics2D g = (Graphics2D) gc;
        int w = getSize().width;
        int h = getSize().height;
        g.setColor(getParent().getBackground());
        g.fillRect(0, 0, w, h);
        if (pattern == null)
            return;
        Insets insets = getInsets();
        Rectangle rect = new Rectangle(insets.left, insets.top, w
                - (insets.left + insets.right), h
View Full Code Here

            }
           
            if (shapePaint!=null) {
                g.setPaint(shapePaint);
            }
            g.fillRect(next.myLeftX, next.myTopY, next.myWidth, next.myHeight);
            g.setColor(Color.black);
            drawBorder(g, next);
        }
        protected void drawBorder(Graphics g, Rectangle next) {
            g.drawLine(next.myLeftX-getCorrectionShift(), next.myTopY, next.getRightX()-getCorrectionShift(), next.myTopY);
View Full Code Here

    BufferedImage result = new BufferedImage((int) (image.getWidth() * xFactor), (int) (image.getHeight() * yFactor), BufferedImage.TYPE_INT_RGB);

    Graphics2D g2 = (Graphics2D) result.getGraphics();

    g2.setColor(Color.WHITE);
    g2.fillRect(0, 0, result.getWidth(), result.getHeight());
   
    g2.drawImage(image, scaleTransform, null);

    return result;
  }
View Full Code Here

    BufferedImage result = new BufferedImage(width, height, imageType);

    Graphics2D g2 = (Graphics2D) result.getGraphics();
   
    g2.setColor(Color.WHITE);
    g2.fillRect(0, 0, width, height);
   
    Canvas canvas = new Canvas();
    Image tImage = image.getScaledInstance(width, height, quality);

    g2.drawImage(tImage, 0, 0, canvas);
View Full Code Here

        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_OVER,
                0.5f)); // Make the gradient ghostlike
        g2.setPaint(new GradientPaint(nStartOfText, 0,
                SystemColor.controlShadow, getWidth(), 0, new Color(255, 255,
                        255, 0)));
        g2.fillRect(nStartOfText, 0, getWidth(), ghostImage.getHeight());

        g2.dispose();

        treetable.getTree().setSelectionPath(path); // Select this path in the
        // tree
View Full Code Here

        Graphics2D g = img.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);

        g.setColor(Color.WHITE);
        g.fillRect(0, 0, width + LABEL_WIDTH, heigh + LABEL_WIDTH);

        // draw lines
        g.setColor(Color.LIGHT_GRAY);
        for (int y = GRID_SIZE; y < classNames.length; y += GRID_SIZE) {
            g.drawLine(0, y * (CELLS_SIZE + CELL_PAD), width, y
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.