當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。