Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

The Name of Technique

 
Peter Sorotokin
Ranch Hand
Posts: 36
1
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I wand to associate a command ( a method ) with an area of a picture . What is the name of the technique that i should use ? and a brief description of it please .
Thanks
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What would trigger the command? Mouse over? Mouse clicked?
In pseudo code
1) Define rectangles. These will be the "trigger areas". Define action mappings for each rectangle.
2) Add an appropriate listener (mouse over, mouse clicked etc) Check out MouseListener and MouseMotionListener
3) After getting a notification in your listener method, get the current mouse co-ordinates and check which rectangle there are in
4) Based on the rectangle, call the appropriate action.

I am not sure if this is true any more, but I remember seeing a cow picture in the swing demo. Different parts of the cow had different tool tips e.g. mouth tool tip was "Moo" You might want to check the latest swing demo code for this or a similar example
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!