The attempt is to enable drawing of figures(a line for now) with mouse on the awt canvas . Iam trying out java graphics for the first time . So not sure how to go about it .
Make use of Line2D object in the AWT package and do the following steps:
boolean variable to check if the click is the first or the
secondList container to contain your Line2D objectsCan objectThe step number 5 could be achieved through:
e.getX()e.getY()Where e is the mouse event and could be accesed through the parameter of the mouse listener method.