> > ...and this seems to end up consuming all of the mouse events, so that
> > I now cannot move my frame (nor launch the popup menu attached to it
> > via a rightclick action)
>
> (Popup events are not necessarily right click actions - you should test
> all mouse events for isPopupTrigger.)
Noted :o)
> > Is this correct behaviour? If so, how should one add a tooltip to a
> > frame with a mouselistener on it?
[quoted text clipped - 3 lines]
> component-container hierarchy. Actually setComponentPopupMenu (since
> 1.5) should be alright as it uses AWTEventListeners.
I've switched to using a JWindow (didn't want a taskbar icon) and all
my mouse events are working, I'm just not getting the tooltip.
> Some of your choices are:
>
> o Add the mouse listeners at exactly the same level as other mouse
> listeners. You may need to play about with ContainerListener to achieve
> this.
I'm not quite sure what you mean by this - I'm not familiar with
ContainerListener - what should I do with it?
I figured that one other option is that since I'm getting the mouse
events ok, I could start a thread in MouseEntered waiting for a
hovering mouse and then throw up a custom tooltip (just another
undecorated JWindow)
Thanks for the thoughts, by the way - I appreciate the ideas.
Thomas Hawtin - 14 Aug 2007 15:38 GMT
> I've switched to using a JWindow (didn't want a taskbar icon) and all
> my mouse events are working, I'm just not getting the tooltip.
Not entirely sure why. Obviously the PL&F will add some mouse listeners
to components of a JFrame. Perhaps there is a problem with Window having
an owner despite it being a top-level component (which is a bit confusing).
Looking at the bug database it looks as if in 1.5 (only) "setToolTipText
does not work if the component is not focussed". The bug database is
down at the moment, but it is in the google cache.
http://64.233.183.104/search?q=cache:UJHZspzxbFQJ:bugs.sun.com/bugdatabase/view_
bug.do%3Fbug_id%3D6178004+6178004+java&hl=en&ct=clnk&cd=1&gl=uk&client=firefox-a
> I'm not quite sure what you mean by this - I'm not familiar with
> ContainerListener - what should I do with it?
If one adds a mouse listeners to a hierarchy of components, and then add
(or remove) a component, that component will need a listener added (or
removed). Container listeners will indicate when a component is added or
removed.
Tom Hawtin