You don't want a while() loop in the mouseListener. You want to increment a counter each time a point is collected until you have recorded the required number of points for your polygon. You may only want to draw the points themselves until you have the entire polygon specified. You'll also need some way to reset it. Perhaps a seventh click or a right-click should clear the points and reset the counter.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 838
Posting Genius
Offline 6,757 posts
since May 2007