This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

2D Line & setCursor  RSS feed

 
S.Subhash Chandran
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we set Cursor for 2D objects?
 
S.Subhash Chandran
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well... you can set the cursor for the component that is holding the 2D objects. And the component can test for the bounds of the 2D objects...

(And set the cursor respectively...)
 
S.Subhash Chandran
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is it done? I know that we setCursor() for an object. How is it done for an area??
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!