Basically I have the following problem:
I have a JLayeredPanel with two JPanels on it. The smaller one is on top of a larger one and both handle their own mouseevents. However, when I click in the bounding box of the smaller JPanel on top I want the click to register on the lower JPanel also as if the top JPanel weren't there .
I thought I could solve this by just having the mousePressed-function of the top JPanel call lowerJPanel.mousePressed(event) , and this kind of works, however, I need to know where the user clicked.
The problem now is that event.getPoint() (which is used in lowerJPanel.mousePressed(event)) returns some relative coördinate. Since the event first registered on the top JPanel, I am now passing a MouseEvent variable with a relative location on the top JPanel and NOT on the lower one.
I have already tried tinkering with Component.dispatchEvent and MouseEvent.setSource, but it didn't help.
Here is an image of the problem:
Thanks for any help!