Java Draw Rectangle drawRect(Graphics g, int left, int top, int width, int height, int lineWidth)

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

Description

_more_

License

Open Source License

Parameter

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

Declaration

public static void drawRect(Graphics g, int left, int top, int width, int height, int lineWidth) 

Method Source Code

//package com.java2s;
/**/*w ww . j  a  va2  s .com*/
* 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 lineWidth _more_
     */
    public static void drawRect(Graphics g, int left, int top, int width, int height, int lineWidth) {
        left = left - lineWidth / 2;
        top = top - lineWidth / 2;
        width = width + lineWidth;
        height = height + lineWidth;
        for (int i = 0; i < lineWidth; i++) {
            g.drawRect(left, top, width, height);
            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, int x, int y, int w, int h)
  3. drawRect(Graphics g, Rectangle r)
  4. drawRect(Rectangle r, Graphics2D g)