UIDefaults Class : UIDefault « Swing « Java Tutorial






UIDefaults Class
import java.awt.Color;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.UIManager;

public class UIDefaultsButton {
  public static void main(String[] args) {

    UIManager.put("Button.background", Color.BLACK);
    UIManager.put("Button.foreground", Color.RED);

    JFrame aWindow = new JFrame("This is a Border Layout");
    aWindow.setBounds(30, 30, 300, 300); // Size
    aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JButton bn = new JButton("asdf");
    aWindow.add(bn);
    aWindow.setVisible(true); // Display the window
  }
}








14.121.UIDefault
14.121.1.UIDefaults ClassUIDefaults Class
14.121.2.Setting a UI Default Value That Is Created at Every Fetch
14.121.3.Setting a UI Default Value That Is Created When Fetched
14.121.4.Getting the Default Values for a Look and Feel
14.121.5.Listing UIDefault Properties
14.121.6.Changing ToolTip background color for Swing Applications
14.121.7.Get default values for Swing-based user interface