Java Swing Look and Feel getLookAndFeelInfo()

Here you can find the source of getLookAndFeelInfo()

Description

Gets all accasseble look and feels.

License

Open Source License

Return

hashtable containing name and info string for all available l&f

Declaration

public static Map<String, String> getLookAndFeelInfo() 

Method Source Code

//package com.java2s;
// it under the terms of the GNU General Public License as published by

import java.io.File;

import java.util.HashMap;

import java.util.Map;

import java.util.logging.Logger;

import javax.swing.UIManager;

public class Main {
    /** jdk1.4 logger */
    private static Logger logger = Logger.getLogger("de.axelwernicke.mypod.gui");
    /** Base directory where the theme packs for the skin look and feel can be found */
    private static final String SKIN_LF_THEME_DIR = "lib" + File.separator + "skinlfthemes";

    /** Gets all accasseble look and feels.
     */*w w w.j  a v  a 2  s.  c  o m*/
     * @return hashtable containing name and info string for all available l&f
     */
    public static Map<String, String> getLookAndFeelInfo() {
        Map<String, String> lookAndFeelInfo = new HashMap<String, String>(20);

        try {
            // add system look and feels
            UIManager.LookAndFeelInfo[] lfInfo = UIManager.getInstalledLookAndFeels();
            for (int i = 0; (lfInfo != null) && (i < lfInfo.length); i++) {
                lookAndFeelInfo.put(lfInfo[i].getName(), lfInfo[i].getClassName());
            }

            // add additional look and feels
            lookAndFeelInfo.put("Kunststoff", "com.incors.plaf.kunststoff.KunststoffLookAndFeel");
            lookAndFeelInfo.put("NEXT", "nextlf.plaf.NextLookAndFeel");

            // add all themes for the skin look and feel
            File themeBase = new File(SKIN_LF_THEME_DIR);
            File[] themes = themeBase.listFiles();
            for (int i = 0; (themes != null) && (i < themes.length); i++) {
                lookAndFeelInfo.put("Skin Look and Feel (" + themes[i].getName() + ")",
                        themes[i].getName() + "@com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
            }
        } catch (Exception ex) {
            logger.warning("Eception raised: " + ex.getMessage());
            ex.printStackTrace();
        }

        return lookAndFeelInfo;
    }
}

Related

  1. getInstalledLookAndFeels()
  2. getLAF(int lafNumber)
  3. getLafClassName(String lafName)
  4. getLookAndFeel(final String displayName)
  5. getLookAndFeel(String name)
  6. getLookAndFeelToSave()
  7. getNimbusLAF()
  8. getSortedInstalledLAFInfos()
  9. getSysDefLookandFeel()