Re: How to send mouse event to another component?
- From: "Thomas Fritsch" <i.dont.like.spam@xxxxxxxxxxx>
- Date: Wed, 23 Nov 2005 23:35:57 +0100
"Rene Ruppert" <rene.ruppert@xxxxxxxxxxx> wrote:
> I have built a JPanel with lots of other small JPanels in it ("Thumbs").
> Now I would like to have all mouseDragged() events on the thumbs to be
> treated as if they happenend on the JPanel they reside in.
> I tried adding a MouseInputAdapter() to each of my thumbs but appearently
> I am missing something important since to mouseDragged() event of my
> outside JPanel is not being called. Can anybody help?
>
> public void mouseDragged(MouseEvent event)
> {
> dispatchEvent(new MouseEvent(thumbPanel,
> MouseEvent.MOUSE_DRAGGED, event.getWhen(),
> event.getModifiers(), event.getX(), event.getY(), 1,
> false));
> }
The method above is in your subclass of JPanel, or did I misunderstand you?
You probably wanted to override method
protected void processMouseMotionEvent(MouseEvent)
or
public boolean mouseDrag(Event e, int x, int y) // deprecated
of class Component.
Class JPanel has or inherits *no* method
void mouseDragged(MouseEvent e)
Hence your method overrides nothing and therefore is not called.
--
"TFritsch$t-online:de".replace(':','.').replace('$','@')
.
- Follow-Ups:
- Re: How to send mouse event to another component?
- From: Rene Ruppert
- Re: How to send mouse event to another component?
- References:
- How to send mouse event to another component?
- From: Rene Ruppert
- How to send mouse event to another component?
- Prev by Date: DefaultTreeCellRenderer moves the placement of children in JTree
- Next by Date: Re: How to send mouse event to another component?
- Previous by thread: How to send mouse event to another component?
- Next by thread: Re: How to send mouse event to another component?
- Index(es):