Example usage for javax.swing UIDefaults getIcon

List of usage examples for javax.swing UIDefaults getIcon

Introduction

In this page you can find the example usage for javax.swing UIDefaults getIcon.

Prototype

public Icon getIcon(Object key) 

Source Link

Document

If the value of key is an Icon return it, otherwise return null.

Usage

From source file:Main.java

public static void main(String[] argv) {
    UIDefaults uidefs = UIManager.getLookAndFeelDefaults();
    String[] keys = (String[]) uidefs.keySet().toArray(new String[0]);
    for (int i = 0; i < keys.length; i++) {
        Object v = uidefs.get(keys[i]);
        if (v instanceof Integer) {
            int intVal = uidefs.getInt(keys[i]);
        } else if (v instanceof Boolean) {
            boolean boolVal = uidefs.getBoolean(keys[i]);
        } else if (v instanceof String) {
            String strVal = uidefs.getString(keys[i]);
        } else if (v instanceof Dimension) {
            Dimension dimVal = uidefs.getDimension(keys[i]);
        } else if (v instanceof Insets) {
            Insets insetsVal = uidefs.getInsets(keys[i]);
        } else if (v instanceof Color) {
            Color colorVal = uidefs.getColor(keys[i]);
        } else if (v instanceof Font) {
            Font fontVal = uidefs.getFont(keys[i]);
        } else if (v instanceof Border) {
            Border borderVal = uidefs.getBorder(keys[i]);
        } else if (v instanceof Icon) {
            Icon iconVal = uidefs.getIcon(keys[i]);
        } else if (v instanceof javax.swing.text.JTextComponent.KeyBinding[]) {
            JTextComponent.KeyBinding[] keyBindsVal = (JTextComponent.KeyBinding[]) uidefs.get(keys[i]);
        } else if (v instanceof InputMap) {
            InputMap imapVal = (InputMap) uidefs.get(keys[i]);
        } else {/*from w ww .  ja v  a 2 s .  c  o  m*/
            System.out.println("Unknown type");
        }
    }
}

From source file:Main.java

public static void main(String[] argv) {
    UIDefaults uidefs = UIManager.getLookAndFeelDefaults();
    String[] keys = (String[]) uidefs.keySet().toArray(new String[0]);
    for (int i = 0; i < keys.length; i++) {
        Object v = uidefs.get(keys[i]);
        if (v instanceof Integer) {
            int intVal = uidefs.getInt(keys[i]);
        } else if (v instanceof Boolean) {
            boolean boolVal = uidefs.getBoolean(keys[i]);
        } else if (v instanceof String) {
            String strVal = uidefs.getString(keys[i]);
        } else if (v instanceof Dimension) {
            Dimension dimVal = uidefs.getDimension(keys[i]);
        } else if (v instanceof Insets) {
            Insets insetsVal = uidefs.getInsets(keys[i]);
        } else if (v instanceof Color) {
            Color colorVal = uidefs.getColor(keys[i]);
        } else if (v instanceof Font) {
            Font fontVal = uidefs.getFont(keys[i]);
        } else if (v instanceof Border) {
            Border borderVal = uidefs.getBorder(keys[i]);
        } else if (v instanceof Icon) {
            Icon iconVal = uidefs.getIcon(keys[i]);
        } else if (v instanceof javax.swing.text.JTextComponent.KeyBinding[]) {
            javax.swing.text.JTextComponent.KeyBinding[] keyBindsVal = (javax.swing.text.JTextComponent.KeyBinding[]) uidefs
                    .get(keys[i]);/*w  w  w  . j ava2  s .c  o  m*/
        } else if (v instanceof InputMap) {
            InputMap imapVal = (InputMap) uidefs.get(keys[i]);
        } else {
            System.out.println("Unknown type");
        }
    }
}

From source file:com.googlecode.vfsjfilechooser2.plaf.basic.BasicVFSFileChooserUI.java

protected void installIcons(VFSJFileChooser fc) {
    UIDefaults defaults = UIManager.getLookAndFeel().getDefaults();
    directoryIcon = lookupIcon("folder.png");
    fileIcon = lookupIcon("file.png");
    computerIcon = defaults.getIcon("FileView.computerIcon");
    hardDriveIcon = defaults.getIcon("FileView.hardDriveIcon");
    floppyDriveIcon = defaults.getIcon("FileView.floppyDriveIcon");
    newFolderIcon = lookupIcon("folder_add.png");
    upFolderIcon = lookupIcon("go-up.png");
    homeFolderIcon = lookupIcon("folder_user.png");
    detailsViewIcon = lookupIcon("application_view_detail.png");
    listViewIcon = lookupIcon("application_view_list.png");
    viewMenuIcon = defaults.getIcon("FileChooser.viewMenuIcon");
}