jlover2010 0 Newbie Poster

Recently i needed to override dome default values of swing properties
I got the answer currently needed.Details are located here

But after that i interested to find a way to have all these pairs (simply HashTable keys and values elements) to override them at the startup of applications to make custom values.

at the moment it's two days of researching (firstly documentations and source codes of jdk6u17 APIs and currently passing lots of pages of Google results) and the most and only useful things i found were two code snippets mentioned below (Both are almost same) :

public static void main(String[] args) {
  static void printUIManagerDefaults()

       Object[] objs = javax.swing.UIManager.
       //java.util.Arrays.sort( objs );
       for( int i = 0; i < objs.length; i++ )
              ", "+javax.swing.UIManager.getDefaults().get(objs[i]));

another one :

public static String windowsUI = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";

    public static void main(String[] args) {
        try {

            UIDefaults def = UIManager.getDefaults();

            for (Enumeration e = def.keys(); e.hasMoreElements();) {

                String key = (String) e.nextElement();

                System.out.println(key + ": " + def.get(key));


        } catch (Exception ex) {




they will print out a lot of information though, but for example you can not find a key such OptionPane.yesButtonText or OptionPane.noButtonText or OptionPane.cancelButtonText or even swing.boldMetal that i used them as the key argument in method UIManager.put in my current application and brought an example in the thread mentioned before.

I'm really tired of searching, i couldn't find the default values from source code (i guess they made from some source code i don't have them :
This is a part of UIManager source code i think (by tracking code snippets) is exactly where the table made, but have no source code :

private static void initializeDefaultLAF(Properties swingProps)
//***find the rest of code yourself ! I dont wanna make here heavy
       HashMap lafData =
                (HashMap) AppContext.getAppContext().get("swing.lafdata");
//***again find by urself

you see I'm doing my effort and will be much appreciate if any one has a useful idea and put it here


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.