Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get default background color of swing component

How to get default background color of swing components? I mean default background color of JPanel?

like image 802
Parag Avatar asked Apr 03 '12 10:04

Parag


1 Answers

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.

like image 183
Mikle Garin Avatar answered Oct 28 '22 21:10

Mikle Garin