how-to

Others

How to get default TextField background color ?

For this task you need to use:

import javax.swing.UIManager;

When you change background of jTextField, and then you want to change it back to default color, use this code:

/* set item`s background to red */

jTextField.setBackground(Color.red);    
...

/* ..and back */

jTextField.setBackground( UIManager.getColor( "TextField.background" ) );    

TIP

For list of UI accessible keys see BasicLookAndFeel.java source.