当前位置: 首页>>代码示例>>Java>>正文


Java UIManager.getDefaults方法代码示例

本文整理汇总了Java中javax.swing.UIManager.getDefaults方法的典型用法代码示例。如果您正苦于以下问题:Java UIManager.getDefaults方法的具体用法?Java UIManager.getDefaults怎么用?Java UIManager.getDefaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.UIManager的用法示例。


在下文中一共展示了UIManager.getDefaults方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTreeCellRendererComponent

import javax.swing.UIManager; //导入方法依赖的package包/类
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  this.label.setIcon(DEFAULT_NODE_ICON);
  this.label.setText(value.toString());

  if (value instanceof DefaultMutableTreeNode) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
    if (node.getUserObject() instanceof IconTreeListItem) {
      IconTreeListItem iconItem = (IconTreeListItem) node.getUserObject();
      this.label.setText(iconItem.getUserObject().toString());
      if (iconItem.getIcon() != null) {
        this.label.setIcon(iconItem.getIcon());
      } else if (iconItem.getUserObject() instanceof Prop) {
        Prop prop = (Prop) iconItem.getUserObject();
        label.setIcon(getIcon(prop));
      }
    }
  }

  UIDefaults defaults = UIManager.getDefaults();
  this.label.setOpaque(true);
  this.label.setBackground(hasFocus || selected ? defaults.getColor("Tree.selectionBackground") : defaults.getColor("Tree.background"));
  this.label.setForeground(hasFocus || selected ? defaults.getColor("Tree.selectionForeground") : defaults.getColor("Tree.foreground"));
  this.label.setBorder(hasFocus ? focusBorder : normalBorder);

  return label;
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:28,代码来源:IconTreeListRenderer.java

示例2: initSwingConstants

import javax.swing.UIManager; //导入方法依赖的package包/类
/** Initialized fields used in Swing Palette. */
private static void initSwingConstants() {
    if (swingColorNames != null)
        return;

    UIDefaults def = UIManager.getDefaults ();
    Enumeration e = def.keys ();
    
    java.util.TreeSet<String> names = new java.util.TreeSet<String>();
    
    while (e.hasMoreElements ()) {
        Object k = e.nextElement ();
        if (! (k instanceof String))
            continue;
        Object v = def.get (k);
        if (! (v instanceof Color))
            continue;
        names.add((String)k);
    }
    
    swingColorNames = new String [names.size ()];
    names.toArray(swingColorNames);
    swingColors = new Color [swingColorNames.length];
    
    int i, k = swingColorNames.length;
    for (i = 0; i < k; i++)
        swingColors [i] = (Color) def.get (swingColorNames [i]);
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:ColorEditor.java

示例3: run

import javax.swing.UIManager; //导入方法依赖的package包/类
public void run() {
    UIDefaults uidef = UIManager.getDefaults();
    synchronized (uidef) {
        blocking = true;
        sleep();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ProgressHandleFactoryTest.java

示例4: install

import javax.swing.UIManager; //导入方法依赖的package包/类
private static void install() {
    // don't install directory chooser if standard chooser is desired
    if (isStandardChooserForced()) {
        return;
    }
    final UIDefaults uid = UIManager.getDefaults();
    originalImpl = (Class<?>) uid.getUIClass(KEY);
    Class<?> impl = DelegatingChooserUI.class;
    final String val = impl.getName();
    // don't install dirchooser if quickfilechooser is present
    if (!isQuickFileChooser(uid.get(KEY))) {
        uid.put(KEY, val);
        // To make it work in NetBeans too:
        uid.put(val, impl);
    }
    // #61147: prevent NB from switching to a different UI later (under GTK):
    uid.addPropertyChangeListener(pcl = new PropertyChangeListener() {
        public @Override void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            Object className = uid.get(KEY);
            if ((name.equals(KEY) || name.equals("UIDefaults")) && !val.equals(className)
                    && !isQuickFileChooser(className)) {
                originalImpl = (Class<?>) uid.getUIClass(KEY);
                uid.put(KEY, val);
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:Module.java

示例5: installFont

import javax.swing.UIManager; //导入方法依赖的package包/类
/**
 * Set the default font in all UI elements.
 *
 * @param defaultFont A {@code Font} to use by default.
 */
public static void installFont(Font defaultFont) {
    UIDefaults u = UIManager.getDefaults();
    java.util.Enumeration<Object> keys = u.keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        if (u.get(key) instanceof javax.swing.plaf.FontUIResource) {
            u.put(key, defaultFont);
        }
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:16,代码来源:FreeColLookAndFeel.java

示例6: Bug6530694

import javax.swing.UIManager; //导入方法依赖的package包/类
Bug6530694() {
    Locale.setDefault(Locale.GERMANY);
    UIDefaults defs = UIManager.getDefaults();
    defs.addResourceBundle("Bug6530694");
    String str = defs.getString("testkey");
    if (!"testvalue".equals(str)) {
        throw new RuntimeException("Could not load the resource for de_DE locale");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:Bug6530694.java


注:本文中的javax.swing.UIManager.getDefaults方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。