File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Fire the ToolTip in different way

 
Shay Gaghe
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Coders
I've extended Jpanel and I draw an Image inside it so that Jpanel is the viewport of the image.
In usual circumstances when i mouse over the image's viewport the ToolTip execute ,but in my case I need to execute the ToolTipText without actually mouse over the image's viewport, instead I need to press a button which in turn execute the ToolTipText that registered with that image�s viewport.
I was thinking about dispatching mouse event but it must be more ways, How can I provide such a performance in efficient way?
Does the Jpanel able to capture mouse event ?
(code please)
thanks in advance
Shay Gaghe
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only way I've found that you can do this is by faking a mouse event in the ActionListener for the button... However, don't set a tool tip for the button, because the ToolTipManager will get confused and replace the tooltip you want to show with the buttons tooltip if you move the mouse around on the button after the tooltip is displayed...

Here's some code to mess around with...



-Nate
 
Shay Gaghe
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wowww! you are good!!
thanks for your effrot , i'll try this.
Shay Gaghe
 
Shay Gaghe
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Nathan
I have tried your code but it dont do what I expect it to do. The button doesnt executes the ToolTip that registered to the icon.
Can you check it again and notice me what is missing?
Sincerely
Shay Gaghe
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you just using the code I posted, or have you changed it some... if you have changed things ( other than just the path to the image, or things like that ), can you post the code you are trying to use it with now?

-Nate

 
Shay Gaghe
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nathan
I have copy and paste your entire code , the only change I made is the image path.
Sincerely
Shay

[This message has been edited by Shay Gaghe (edited October 19, 2001).]
 
Shay Gaghe
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nathan
i use JDK 1.3 , Swing
Shay
 
Shay Gaghe
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nathan
I stuck with that problem for several days. Its seem like you are the advanced programmer here who can help me.
Please
Shay Gaghe
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry! I'm using the JDK 1.4... Sun must have added something that makes this work... I'm trying to figure out if I can get this to work under 1.3...

-Nate
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, if you change the MouseEvent in the action listener from MouseEvent.MOUSE_ENTERED to MouseEvent.MOUSE_MOVED, it should work... sorry for the confusion...
New TipActivate class:
 
Shay Gaghe
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nathan
I tried to change the things as you said but its doesn�t work. I tried all the possible and the logic combination. Im sure its regarding to the version that I use (1.3 ) because I did the same thing with 1.1.2 version in success .
What you suggest me to do?
Thanks
Shay Gaghe
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Upgrade to 1.4? Just kidding... I think this might work... it appeared to work under the JDK 1.3 shipped with JBuilder 4... looks like for some reason, the 1.3 JDK requires you to have a MouseEntered event, then a MouseMoved event... not just one or the other by themselves...



-Nate
 
Shay Gaghe
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nathan
I tried it and its work perfectly ,
Thank you very much Nathan
Im very appreciate your effort
Sincerely
Shay Gaghe
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic