Painting of lightweight Swing components is delegated to the pluggable look-and-feel implementation. This is why you aren't seeing any painting code in JMenu
.
In the case of JMenu
the class responsible for painting would be a child of javax.swing.plaf.MenuItemUI
. Exactly which depends on what L&F you are using. For example, the Windows L&F would delegate painting of the menu to com.sun.java.swing.plaf.windows.WindowsMenuUI
Probably the easiest way to achieve your goal is to look at the implementation for the particular L&F you want to extend, then override the paintComponent()
method to perform your custom painting.
Take a look at "Performing Custom Painting" for a decent explaination on how to paint custom components.