Get default values for Swing-based user interfaceTag(s): Swing

This little class will dump to stdout the default values used by Swing. You can redirect the result to a file with
>java UIDefaults > swing.props

import java.util.Comparator;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

import javax.swing.UIManager;

public class UIDefaults {
    public static void main(String[] args) {
       try {
          Set defaults = UIManager.getLookAndFeelDefaults().entrySet();
          // this TreeSet will hold the sorted properties
          TreeSet ts = new TreeSet(new Comparator() {
             public int compare(Object a, Object b) {
                Map.Entry ea = (Map.Entry) a;
                Map.Entry eb = (Map.Entry) b;
                  ((String) ea.getKey()).compareTo(((String)eb.getKey()));
          for (Iterator i = ts.iterator(); i.hasNext();) {
             Map.Entry entry = (Map.Entry);
             System.out.print(entry.getKey() + " = " );

       } catch (Exception ex) {
  • For an example on how to change a default value see this HowTo
  • To change a value for a particuliar component, see this HowTo
  • Here a sample list for JavaUIDefaults
    blog comments powered by Disqus