Posted by kermitthefragger
on May 26, 2009 at 2:47 AM PDT
First of all thanks for all the great work done on JXLayer. Its a great tool and I'm really pleased to see it will get incorporated into the JDK.
I would like to use JXLayer to solve a Swing problem I never really found a good solution for:
The problem seems simple: I want to be able to receive mouse hoover events (mouseEntered and mouseExited) when the mouse is over a JPanel (So you can hide elements on it, change the background color, etc.); One event when it enters it, one event when it exists it. The problem lies in the fact that when I hoover my mouse over a subcomponent in the JPanel I receive a mouseExited and a mouseEntered event from the panel. This is of course because the mouse exits the panel, enters the subcomponent, exits the subcomponent and enters the panel again.
The simplest the solution for this would be to check if the event originated from within the panel bounds however this is unreliable because when you move the mouse with some speed you get strange results. I think this is influenced (for beter or worse) by the mouse precision which is offered by the platform you run the application on.
So I thought JXLayer to the rescue :-) . I have been fiddling around with overriding eventDispatched of AbstractLayerUI but I havent been able to come up with something that masks events of a panel generated by entering subcomponents.
Was JXLayer designed for something like this ? Or am I trying to ram a nail with a screwdriver in the wall ?