Package java.awt

Examples of java.awt.Graphics.fillRect()


    int height = res.getImageHeight();
    // fill the background
    {
      Graphics g = res.getBufferedImg().getGraphics();
      g.setColor(bgColor);
      g.fillRect(0, 0, width, height);
    }
    // create the object
    int cx = width / 2;
    int cy = height / 2;
    double pi2 = 2.0 * Math.PI;
 
View Full Code Here


  }

  public void fillBackground(int pR, int pG, int pB) {
    Graphics g = bufferedImg.getGraphics();
    g.setColor(new Color(pR, pG, pB));
    g.fillRect(0, 0, imageWidth, imageHeight);
  }

  public void resetImage(int pWidth, int pHeight) {
    bufferedImg = new BufferedImage(pWidth, pHeight, BufferedImage.TYPE_INT_RGB);
    imageWidth = pWidth;
View Full Code Here

  @Override
  protected void fillImage(SimpleImage res) {
    Graphics g = res.getBufferedImg().getGraphics();
    g.setColor(bgColor);
    g.fillRect(0, 0, res.getImageWidth(), res.getImageHeight());
  }

  public Color getBgColor() {
    return bgColor;
  }
View Full Code Here

                    BufferedImage.TYPE_INT_RGB);
            Graphics drawable = image.getGraphics();

            // Background
            drawable.setColor(Color.white);
            drawable.fillRect(0, 0, 640, 480);

            final int rows = 10;
            final int cols = 10;

            // Grid
View Full Code Here

                    if (Math.random() < 0.5f) {
                        drawable.setColor(Color.white);
                    } else {
                        drawable.setColor(Color.black);
                    }
                    drawable.fillRect(gridx + 1, gridy + 1, gridxnext - gridx
                            - 1, gridynext - gridy - 1);
                }
            }

            try {
View Full Code Here

                    BufferedImage.TYPE_INT_RGB);
            Graphics drawable = image.getGraphics();

            // Background
            drawable.setColor(Color.white);
            drawable.fillRect(0, 0, 300, 300);

            final int rows = 4;
            final int cols = 4;

            // Grid
View Full Code Here

                        drawable.setColor(Color.black);
                    } else {
                        drawable.setColor(Color.white);
                    }

                    drawable.fillRect(gridx + 1, gridy + 1, gridxnext - gridx
                            - 1, gridynext - gridy - 1);
                }
            }

            try {
View Full Code Here

            /* Create an image and draw something on it. */
            BufferedImage image = new BufferedImage(270, 270,
                    BufferedImage.TYPE_INT_RGB);
            Graphics drawable = image.getGraphics();
            drawable.setColor(bgColor);
            drawable.fillRect(0, 0, 270, 270);
            drawable.setColor(fgColor);
            drawable.fillOval(25, 25, 220, 220);
            drawable.setColor(java.awt.Color.blue);
            drawable.drawRect(0, 0, 269, 269);
            drawable.setColor(java.awt.Color.black);
View Full Code Here

        // Create an image and draw some background on it.
        BufferedImage image = new BufferedImage(200, 200,
                BufferedImage.TYPE_INT_RGB);
        Graphics drawable = image.getGraphics();
        drawable.setColor(Color.lightGray);
        drawable.fillRect(0, 0, 200, 200);
        drawable.setColor(Color.yellow);
        drawable.fillOval(25, 25, 150, 150);
        drawable.setColor(Color.blue);
        drawable.drawRect(0, 0, 199, 199);
View Full Code Here

        BufferedImage image = new BufferedImage(200, 200,
                BufferedImage.TYPE_INT_RGB);
        Graphics drawable = image.getGraphics();
        drawable.setColor(Color.lightGray);
        drawable.fillRect(0, 0, 200, 200);
        drawable.setColor(Color.yellow);
        drawable.fillOval(25, 25, 150, 150);
        drawable.setColor(Color.blue);
        drawable.drawRect(0, 0, 199, 199);
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.