Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

The Name of Technique

Ranch Hand
Posts: 36
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 .
Posts: 11497
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
We don't have time for this. We've gotta save the moon! Or check this out:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic