Java Draw Line awt drawLine(Graphics g, int x1, int y1, int x2, int y2)

Here you can find the source of drawLine(Graphics g, int x1, int y1, int x2, int y2)

Description

Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system.

License

Open Source License

Parameter

Parameter Description
x1 the first point's <i>x</i> coordinate.
y1 the first point's <i>y</i> coordinate.
x2 the second point's <i>x</i> coordinate.
y2 the second point's <i>y</i> coordinate.

Declaration

public static void drawLine(Graphics g, int x1, int y1, int x2, int y2) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.Graphics;

public class Main {
    /**// w w  w.j a v a2  s. c  o m
    * Draws a line, using the current color, between the points
    * <code>(x1,&nbsp;y1)</code> and <code>(x2,&nbsp;y2)</code>
    * in this graphics context's coordinate system.
    * @param   x1  the first point's <i>x</i> coordinate.
    * @param   y1  the first point's <i>y</i> coordinate.
    * @param   x2  the second point's <i>x</i> coordinate.
    * @param   y2  the second point's <i>y</i> coordinate.
    */
    public static void drawLine(Graphics g, int x1, int y1, int x2, int y2) {
        g.drawLine(x1, y1, x2, y2);
    }
}

Related

  1. drawLine(Graphics g, int x1, int y1, int x2, int y2, boolean thick)
  2. drawLine(Graphics g, int x1, int y1, int x2, int y2, int lineWidth)
  3. drawLine(Graphics g, int x1, int y1, int x2, int y2, int lineWidth)
  4. drawLine(Graphics render, int row, String text)