Java Graphics Draw paintRectCompartment(Graphics g, Dimension size, int x, int y, Color fillColor, Color strokeColor)

Here you can find the source of paintRectCompartment(Graphics g, Dimension size, int x, int y, Color fillColor, Color strokeColor)

Description

Paints the rectangle compartment at given coordinate with given fill color and stroke color.

License

Open Source License

Parameter

Parameter Description
g the graphics to paint on
size the rectangle size
x x location of the rectangle
y y location of the rectangle
fillColor fill color
strokeColor stroke color

Declaration

static void paintRectCompartment(Graphics g, Dimension size, int x, int y, Color fillColor, Color strokeColor) 

Method Source Code


//package com.java2s;
import java.awt.*;

public class Main {
    /**//from w  w w.  j a va  2s  .com
     * <p>
     * Paints the rectangle compartment at given coordinate with given fill color and stroke color.
     * </p>
     * @param g
     *            the graphics to paint on
     * @param size
     *            the rectangle size
     * @param x
     *            x location of the rectangle
     * @param y
     *            y location of the rectangle
     * @param fillColor
     *            fill color
     * @param strokeColor
     *            stroke color
     */
    static void paintRectCompartment(Graphics g, Dimension size, int x, int y, Color fillColor, Color strokeColor) {
        g.setColor(fillColor);
        g.fillRect(x, y, size.width, size.height);
        g.setColor(strokeColor);
        g.drawRect(x, y, size.width, size.height);
    }
}

Related

  1. paintFocus(Graphics g, int x, int y, int width, int height, int r1, int r2, float grosor, Color color)
  2. paintKnurl3(java.awt.Graphics g2, float x, float y, float width, float height)
  3. paintLine(Graphics2D g2, Point2D.Double from, Point2D.Double to)
  4. paintOval(int x, int y, Color c, int size, Graphics g)
  5. paintPoint(java.awt.Graphics g2, int x, int y)
  6. paintRectShadow(Graphics g, int x, int y, int width, int height)
  7. paintShape(Shape shape, Graphics2D g2d, Color colorStroke, Stroke stroke, Color colorFill, double downsample)
  8. paintSprite(Graphics g, int x, int y, int[][] sprite, Color[] colors)
  9. prepareGraphics(Graphics g)