Makes a solid 3D rectangle in the given color. - Java 2D Graphics

Java examples for 2D Graphics:Rectangle

Description

Makes a solid 3D rectangle in the given color.

Demo Code


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

public class Main {
    /** Makes a solid 3D rectangle in the given color.
     */*from  ww  w  .  j  a v a 2 s .  c  o  m*/
     * @param g The Graphics object.
     * @param left The x-coordinate of left side edge.
     * @param top The y-coordinate of the top edge.
     * @param width Distance from L side to R side.
     * @param height Distance from top side bottom side.
     * @param isRaised A boolean variable that determines
     *                 if the right and bottom sides are
     *                 shaded to try to make the rectangle
     *                 look like it is higher than
     *                 background (true) or lower (false).
     *                 Works best with gray colors.
     * @param c The pen color.
     */

    public static void fill3DRect(Graphics g, int left, int top, int width,
            int height, boolean isRaised, Color c) {
        Color origColor = g.getColor();
        g.setColor(c);
        g.fill3DRect(left, top, width, height, isRaised);
        g.setColor(origColor);
    }
}

Related Tutorials