Java examples for 2D Graphics:Rectangle
Draws a solid rounded rectangle with the specified color.
//package com.java2s; import java.awt.*; public class Main { /** Draws a solid rounded rectangle with the * specified color. Same as g.fillRoundRect except * for the color./*from w w w. j a va2 s .c o m*/ * * @param g The Graphics object. * @param left Center of left side edge. * @param top Center of the top edge. * @param width Distance from center of L side to * center of R side. * @param height Distance from center of top side to * center of bottom side. * @param arcWidth Horizontal diameter of arc at * corners. * @param arcHeight Vertical diameter of arc at * corners. * @param c Pen color. */ public static void fillRoundRect(Graphics g, int left, int top, int width, int height, int arcWidth, int arcHeight, Color c) { Color origColor = g.getColor(); g.setColor(c); g.fillRoundRect(left, top, width, height, arcWidth, arcHeight); g.setColor(origColor); } }