Getting the position of a mouseDown event

Hi,

I have an app where I have to track where the user clicks the mouse on the screen. The idea is simple, user sees a shape on the screen and I need to track if the mouse is clicked within the bounds of this. Problem is I can do this if the shape is a polygon but I want to allow the user to draw a freehand shape them selves and determine if they clicked within the bounds of this. What other options are available to me?

[436 byte] By [JFrain2004a] at [2007-11-27 4:04:47]
# 1

The position (relative to the target component) is contained in the MouseEvent. The most common alogirhm to determine "inside" is

draw a line from infinity to the point, count how many times it crosses a boundary element of your shape. If the resulting count is even then it's "outside", if odd inside.

malcolmmca at 2007-7-12 9:09:41 > top of Java-index,Java Essentials,Java Programming...