To draw a line using the Graphics2D graphics context, you first construct a path, an instance of the GeneralPath class, such as path in the following illustration:
Graphics2D
GeneralPath
path
GeneralPath path = new GeneralPath();