I am trying to use Java to implement a feature that is very like to polygon lasso tool in any image processing software, like FireWords, PhotoShop.
Basically, when a user clicks the polygon lasso icon I provided, he is ready to start to draw a polygon lasso. When he clicks anywhere in a drawing area, a dot will show up there; clicks again, a new dot will apprear. There is a solid or arrow between two dots. The last dot must overlap the first dot and it represents the drawing is finished and a polygon will appear; all points are decided by my clicks.
There are several constraints:
1. A user can only click selected times, i.e.: he can only click 5 times. Clicks beyond 5 times will not be accepted (no dot appeared)
2. A user must click selected times, i.e.: he must click 5 times. If he just clicks twice and decides to terminate the drawing, all dots and connected lines will disappear
3. The last dot and the first dot must be overlapped. Please note: As long as two points are very close, say, 2 px, we still say they are overlapped.
4. If the last dot and the first dot does not overlapped, I may choose to accept or not accept the drawing. If I do not accept it, all dots and connected lines will disappear