Java Draw Rectangle drawRoundRect(Graphics g, int left, int top, int width, int height, int arcWidth, int arcHeight, int lineWidth)

Here you can find the source of drawRoundRect(Graphics g, int left, int top, int width, int height, int arcWidth, int arcHeight, int lineWidth)

Description

_more_

License

Open Source License

Parameter

Parameter Description
g _more_
left _more_
top _more_
width _more_
height _more_
arcWidth _more_
arcHeight _more_
lineWidth _more_

Declaration

public static void drawRoundRect(Graphics g, int left, int top, int width, int height, int arcWidth,
        int arcHeight, int lineWidth) 

Method Source Code

//package com.java2s;
/**/* w  w w. ja  va 2 s  .  c  o m*/
* Copyright (c) 2008-2015 Geode Systems LLC
* This Software is licensed under the Geode Systems RAMADDA License available in the source distribution in the file 
* ramadda_license.txt. The above copyright notice shall be included in all copies or substantial portions of the Software.
*/

import java.awt.*;

public class Main {
    /**
     * _more_
     *
     * @param g _more_
     * @param left _more_
     * @param top _more_
     * @param width _more_
     * @param height _more_
     * @param arcWidth _more_
     * @param arcHeight _more_
     * @param lineWidth _more_
     */
    public static void drawRoundRect(Graphics g, int left, int top, int width, int height, int arcWidth,
            int arcHeight, int lineWidth) {
        left = left - lineWidth / 2;
        top = top - lineWidth / 2;
        width = width + lineWidth;
        height = height + lineWidth;
        for (int i = 0; i < lineWidth; i++) {
            g.drawRoundRect(left, top, width, height, arcWidth, arcHeight);
            if ((i + 1) < lineWidth) {
                g.drawRoundRect(left, top, width - 1, height - 1, arcWidth, arcHeight);
                g.drawRoundRect(left + 1, top, width - 1, height - 1, arcWidth, arcHeight);
                g.drawRoundRect(left, top + 1, width - 1, height - 1, arcWidth, arcHeight);
                g.drawRoundRect(left + 1, top + 1, width - 1, height - 1, arcWidth, arcHeight);
                left = left + 1;
                top = top + 1;
                width = width - 2;
                height = height - 2;
            }
        }
    }
}

Related

  1. drawRect(Graphics g, int x, int y, int w, int h)
  2. drawRect(Graphics g, Rectangle r)
  3. drawRect(Rectangle r, Graphics2D g)
  4. drawRectOrOval(Graphics2D g, boolean oval, int arc, int x, int y, int width, int height)
  5. drawRectPlot(Graphics2D g, int x, int y, int size)
  6. drawThickRect(Graphics g, int x, int y, int w, int h, int d)
  7. drawThickRect(Graphics g, int x, int y, int width, int height, int thickness)