Pass MouseEvent ownership to new component


#1

How can I do this?

1. Click on a component than imediately creates a slider during the mouseDown.

2. The slider behaves as if it received the mouseDown and now owns the mouseDrag and mouseUp.

Is this clear?

 


#2

It's really not designed to move ownership around like that, but presumably you're trying to build something like the pop-up volume controls in tracktion? If so, the way to do it is just to make the new popup component a mouselistener that's attached to the one that received the mouse-down (and which continues to get the drag events). It won't get a mouse-down, but it will get any subsequent drag events. No idea whether the slider class will work ok without the mouseDown though.


#3

Yes I am trying to implement a popup slider for volume, pan, etc.

BTW, sliders do not work with out the mouseDown.

I found a solution by calling the slider's mouseDown, mouseDrag, mouseUp events from the parent's events. Of course I had adjust the coordinates to be relative to the slider. The great news is, it all worked fine.

I was hoping there was a quick way, but did not expect it.

Thanks