Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setToolTipText method

 
Samer Telawi
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dears,
currently I am working on an application in which I have small JPanels that represent some Items and I can move them by clicking on anyone of them inside another JPanel I called it sessionPanel that holds all the others, but when I add setToolTipText for the movable jpanels
I can not move them anymore
does anyone can give me a reasonable explanation
thanks
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post a SSCCE?
 
Randall Twede
Ranch Hand
Posts: 4409
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the location of the tool tip is relative to the location of the panel(like dialogs). if you can, delay calling the method until it is needed(like on mouse over).
not sure if that helps any.
 
Rob Camick
Ranch Hand
Posts: 2584
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you use setToolTipText() a MouseListener is added to the component so tool tip processing can be implemented. I would guess that this mouse listener is receiving the mouse event and consuming them so they don't get passed to your mouse listener.

Try changing you code to look something like:



Swing dispatches the event in reverser order that the mouse listener is added to the component so you listener should be executed first.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic