I’m making a project for college, where I have to make my own primitive vector editor, and I have two questions:
- Is it right to make vector line object by saving it’s start point coordinates, end point coordinates, color and width of points, which it will consist of?
Pointis also my class, which is drawn onJPanel. - If it is right, how can I make this line selectable? The only thing I can think of is to check mouse coordinates to be inside of line width.
I also have a restriction not to use any standard functions for drawing lines, splines, etc.
Area, which implementsShapeand thus contains, which is the method you want.Areais a great abstraction because it can represent any shape but everything gets manipulated in the same way.