Calls g.fillOval(left, top, width, height) after setting the color appropriately. - Java 2D Graphics

Java examples for 2D Graphics:Oval

Description

Calls g.fillOval(left, top, width, height) after setting the color appropriately.

Demo Code


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

public class Main {
    /** Calls g.fillOval(left, top, width, height)
     *  after setting the color appropriately. Resets
     *  color after drawing.//from w  ww  . j a  v a  2 s.  c  om
     *
     * @param g The Graphics object.
     * @param left The left side of the bounding rectangle.
     * @param top The y-coordinate of the top of the
     *            bounding rectangle.
     * @param width The width of the bounding rectangle.
     * @param height The height of the bounding rectangle.
     * @param c The color in which to draw.
     */

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

Related Tutorials