JButton button = new JButton("Click Me"); Color backgroundColor = UIManager.getColor("Button.background"); button.setBackground(backgroundColor);
JLabel label = new JLabel("Name:"); JTextField textField = new JTextField(20); Color foregroundColor = UIManager.getColor("Label.foreground"); textField.setForeground(foregroundColor);The javax.swing.UIManager package is used for accessing the look and feel of the Java Swing user interface.