posted 21 years ago
Here's some code illustrating the concept I was talking about... only one component ( the main JPanel class ) is used... but it keeps track of the Shapes that it draws, and it knows what cursor to set for what shape ( it just uses corresponding array indices... you could use a HashMap to attach specific cursors to specific shapes, or you could make a new class that provides both a shape and a cursor, etc. ). Then it listens for mouse events to intersect with the shape and changes the cursor.
(Edited, because some of the code lines were really long...)
[ January 13, 2003: Message edited by: Nathan Pruett ]
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.