Get default background color of swing component

To get DEFAULT color that panel will use when it is created use:

Color color = UIManager.getColor ( "Panel.background" );

To get CURRENT panel background use:

Color color = panel.getBackground ();

For a complete list of UIManager colour properties, see http://alvinalexander.com/java/java-uimanager-color-keys-list.

Leave a Comment