Adds a Color argument to the fillArc method of java.awt.Graphics. - Java 2D Graphics

Java examples for 2D Graphics:Arc

Description

Adds a Color argument to the fillArc method of java.awt.Graphics.

Demo Code


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

public class Main {
    /** Adds a Color argument to the fillArc method of
     *  java.awt.Graphics./*  w ww  .j a v a2 s .  c om*/
     *
     * @param g The Graphics object.
     * @param x The left side of the bounding rectangle
     * @param y The top of the bounding rectangle
     * @param width The width of the bounding rectangle
     * @param height The height of the bounding rectangle
     * @param startAngle The beginning angle
     *                   <B>in degrees.</B> 0 is 3
     *                   o'clock, increasing
     *                   counterclockwise.
     * @param deltaAngle The sweep angle in degrees
     *                   (going counterclockwise).
     * @param c The color in which to draw the arc.
     */

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

Related Tutorials