I'm developing a desktop application which consists of overlapping jpanels. Those jpanels are transparent and include some jbuttons. What I want my application to do is to redispatch mouse events to below jpanels if user clicks buttonless areas. However, I could not get which jpanels below those jpanels. java.awt.container class has getComponentAt(int x, int y) method but it gives only component at top. javax.swing.SwingUtilities class has getDeepestComponentAt(Component parent, int x, int y) method but it gives only the deepest. Those methods do not meet my needs. Is it possible to implement methods like JComponent getComponentAt(int x, int y, int z-order) or JComponent[] getComponentsAt(int x, int y). Only possible solution I found is using getComponents() to get all components and checking their locations with their z-orders. However, I will have too many components in the application and this way is cpu consuming. Is it possible to access jpanels in a better way?
Note: Could not add image to support the question, since my reputation is not high enough sorry for that.