zoukankan      html  css  js  c++  java
  • e870. 获取默认外观的数据

    This example demonstrates how to retrieve all the default values for the current look and feel.

        // Get the currently installed look and feel
        UIDefaults uidefs = UIManager.getLookAndFeelDefaults();
        
        // Retrieve the keys. Can't use an iterator since the map
        // may be modified during the iteration. So retrieve all at once.
        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]);
            } else if (v instanceof InputMap) {
                InputMap imapVal = (InputMap)uidefs.get(keys[i]);
            } else {
                // Unknown type
            }
        }
    
    Related Examples
  • 相关阅读:
    java处理高并发高负载类网站的优化方法
    谈谈Memcached与Redis
    php中const与define的使用区别 详解
    ecshop添加模板与库文件
    ECShop 2.5.1 的结构图及各文件相应功能介绍
    Uva10972(RevolC FaeLoN)
    交叉染色法判断二分图
    边双联通问题求解(构造边双连通图)POJ3352(Road Construction)
    POI1999(仓库管理员)
    ZOJ1311(Network)
  • 原文地址:https://www.cnblogs.com/borter/p/9596153.html
Copyright © 2011-2022 走看看