I'm using setComponentZOrder() to have overlapping components but the last component I click on is always drawn on top. How do I fix this?

John Zukowski

When components overlap, be sure their container returns false from the isOptimizedDrawingEnabled() method that is inherited from JComponent. This ensures that lower z-order components are not drawn on top of higher components.