Hi All, I want to make an applet which consists of a map (say an applet consisting of India map). Now what i want is to add a tooltip to this map. I mean i want that this applet should show the desired small message(like if i am moving my cursor in Delhi it must show Delhi,again if i am moving my cursor anywhere else in this map then according to the area it will show a tool tip or message.) I think you all get what i want to say so please tell me how i can do this. If you did not got my question then i am giving a link just click on it ,it will take you in a new window(it is an applet). Now move your mouse in this window you will got what i wanted to do. That link is http://www.smartdatavision.com/products/mapapplet/demo/
You can add a MouseMotionListener to the component that displays the map. Its mouseMoved method provides you with MouseEvents that position the mouse got moved to. If that position is inside of an "interesting" region (say, a city you want to display a tooltip for) you can draw the text (possible on a yellow background with a black border) at that position.
Moving to the AWT/Swing/GUI forum, as there's nothing applet-specific about the problem.
Your JDK should have a Demo directory. The SwingSet Demo has a tooltip demo. It displays a picture of a cow. If you mouse over the tail you get "Tail" as a tooltip. If you mouse over the mouth you get "Moo"! If I understand correctly, it is exactly what you want. Just take a look at the source code.