With MadProgrammer's approach you will get menubar background painted twice - once by the UI (it could be gradient on Windows for example, which takes some time to paint) and once by your code in paintComponent method (atop of the old background).
Better replace menubar UI by your own one based on BasicMenuBarUI:
menuBar.setUI ( new BasicMenuBarUI ()
{
public void paint ( Graphics g, JComponent c )
{
g.setColor ( Color.RED );
g.fillRect ( 0, 0, c.getWidth (), c.getHeight () );
}
} );
You can also set that UI globally for all menubars so that you don't need to use your specific component each time you create menubar:
UIManager.put ( "MenuBarUI", MyMenuBarUI.class.getCanonicalName () );
MyMenuBarUI class here is your specific UI for all menubars.