Draws a line, using the current color, between the points in this graphics context's coordinate system. - Java 2D Graphics

Java examples for 2D Graphics:Text

Description

Draws a line, using the current color, between the points in this graphics context's coordinate system.

Demo Code


//package com.java2s;

import java.awt.Graphics;

public class Main {
    /**//from ww w .j av a2 s  .  co m
     * Draws a line, using the current color, between the points (xStart,
     * yStart) and (xEnd, yEnd) in this graphics context's coordinate system.
     * 
     * @param g
     * @param xStart
     * @param yStart
     * @param xEnd
     * @param yEnd
     */
    public static void drawLine(Graphics g, int xStart, int yStart,
            int xEnd, int yEnd) {
        g.drawLine(xStart, yStart, xEnd, yEnd);
    }
}

Related Tutorials