View RSS Feed

Java AWT

Java Abstract Window Toolkit (AWT)

  1. Drawing a Line

    by , 03-06-2012 at 08:46 PM
    Line2D class is used to present the line segment(x,y) in coordinate space. To specify the lines in double precision & float, use these lines.

    • Line2D.Double
    • Line2D.Float

    Code below explains the drawing of a line.
    Java Code:
    // draw Line2D.Double
    g2.draw(new Line2D.Double(x1, y1, x2, y2));
    Different setline() methods are used by the Line class for explaining end points of line. End point of line will be specified by this given ...