⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uidefaults.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
   */  public Font getFont(Object key, Locale locale)  {    Object o = get(key, locale);    return o instanceof Font ? (Font) o : null;  }  /**   * Returns a color entry for the default locale.   *   * @param key the key to the requested entry   *   * @return the color entry for <code>key</code> or null if no such entry   *     exists   */  public Color getColor(Object key)  {    Object o = get(key);    return o instanceof Color ? (Color) o : null;  }  /**   * Returns a color entry for a specic locale.   *   * @param key the key to the requested entry   * @param locale the locale to the requested entry   *   * @return the color entry for <code>key</code> or null if no such entry   *     exists   */  public Color getColor(Object key, Locale locale)  {    Object o = get(key, locale);    return o instanceof Color ? (Color) o : null;  }  /**   * Returns an icon entry for the default locale.   *   * @param key the key to the requested entry   *   * @return the icon entry for <code>key</code> or null if no such entry   *     exists   */  public Icon getIcon(Object key)  {    Object o = get(key);    return o instanceof Icon ? (Icon) o : null;  }  /**   * Returns an icon entry for a specic locale.   *   * @param key the key to the requested entry   * @param locale the locale to the requested entry   *   * @return the icon entry for <code>key</code> or null if no such entry   *     exists   */  public Icon getIcon(Object key, Locale locale)  {    Object o = get(key, locale);    return o instanceof Icon ? (Icon) o : null;  }  /**   * Returns a border entry for the default locale.   *   * @param key the key to the requested entry   *   * @return the border entry for <code>key</code> or null if no such entry   *     exists   */  public Border getBorder(Object key)  {    Object o = get(key);    return o instanceof Border ? (Border) o : null;  }  /**   * Returns a border entry for a specic locale.   *   * @param key the key to the requested entry   * @param locale the locale to the requested entry   *   * @return the border entry for <code>key</code> or null if no such entry   *     exists   */  public Border getBorder(Object key, Locale locale)  {    Object o = get(key, locale);    return o instanceof Border ? (Border) o : null;  }  /**   * Returns a string entry for the default locale.   *   * @param key the key to the requested entry   *   * @return the string entry for <code>key</code> or null if no such entry   *     exists   */  public String getString(Object key)  {    Object o = get(key);    return o instanceof String ? (String) o : null;  }  /**   * Returns a string entry for a specic locale.   *   * @param key the key to the requested entry   * @param locale the locale to the requested entry   *   * @return the string entry for <code>key</code> or null if no such entry   *     exists   */  public String getString(Object key, Locale locale)  {    Object o = get(key, locale);    return o instanceof String ? (String) o : null;  }  /**   * Returns an integer entry for the default locale.   *   * @param key the key to the requested entry   *   * @return the integer entry for <code>key</code> or null if no such entry   *     exists   */  public int getInt(Object key)  {    Object o = get(key);    return o instanceof Integer ? ((Integer) o).intValue() : 0;  }  /**   * Returns an integer entry for a specic locale.   *   * @param key the key to the requested entry   * @param locale the locale to the requested entry   *   * @return the integer entry for <code>key</code> or null if no such entry   *     exists   */  public int getInt(Object key, Locale locale)  {    Object o = get(key, locale);    return o instanceof Integer ? ((Integer) o).intValue() : 0;  }  /**   * Returns a boolean entry for the default locale.   *   * @param key the key to the requested entry   *   * @return The boolean entry for <code>key</code> or <code>false</code> if no    *         such entry exists.   */  public boolean getBoolean(Object key)  {    return Boolean.TRUE.equals(get(key));  }  /**   * Returns a boolean entry for a specic locale.   *   * @param key the key to the requested entry   * @param locale the locale to the requested entry   *   * @return the boolean entry for <code>key</code> or null if no such entry   *     exists   */  public boolean getBoolean(Object key, Locale locale)  {    return Boolean.TRUE.equals(get(key, locale));  }  /**   * Returns an insets entry for the default locale.   *   * @param key the key to the requested entry   *   * @return the insets entry for <code>key</code> or null if no such entry   *     exists   */  public Insets getInsets(Object key)   {    Object o = get(key);    return o instanceof Insets ? (Insets) o : null;  }  /**   * Returns an insets entry for a specic locale.   *   * @param key the key to the requested entry   * @param locale the locale to the requested entry   *   * @return the boolean entry for <code>key</code> or null if no such entry   *     exists   */  public Insets getInsets(Object key, Locale locale)   {    Object o = get(key, locale);    return o instanceof Insets ? (Insets) o : null;  }  /**   * Returns a dimension entry for the default locale.   *   * @param key the key to the requested entry   *   * @return the dimension entry for <code>key</code> or null if no such entry   *     exists   */  public Dimension getDimension(Object key)   {    Object o = get(key);    return o instanceof Dimension ? (Dimension) o : null;  }  /**   * Returns a dimension entry for a specic locale.   *   * @param key the key to the requested entry   * @param locale the locale to the requested entry   *   * @return the boolean entry for <code>key</code> or null if no such entry   *     exists   */  public Dimension getDimension(Object key, Locale locale)   {    Object o = get(key, locale);    return o instanceof Dimension ? (Dimension) o : null;  }  /**   * Returns the ComponentUI class that renders a component. <code>id</code>   * is the ID for which the String value of the classname is stored in   * this UIDefaults map.   *   * @param id the ID of the UI class   * @param loader the ClassLoader to use   *   * @return the UI class for <code>id</code>   */  public Class getUIClass(String id, ClassLoader loader)  {    String className = (String) get (id);    if (className == null)      return null;    try       {        if (loader == null)          loader = ClassLoader.getSystemClassLoader();        return loader.loadClass (className);      }    catch (Exception e)      {        return null;      }  }  /**   * Returns the ComponentUI class that renders a component. <code>id</code>   * is the ID for which the String value of the classname is stored in   * this UIDefaults map.   *   * @param id the ID of the UI class   *   * @return the UI class for <code>id</code>   */  public Class getUIClass(String id)  {    return getUIClass (id, null);  }  /**   * If a key is requested in #get(key) that has no value, this method   * is called before returning <code>null</code>.   *   * @param msg the error message   */  protected void getUIError(String msg)  {    System.err.println ("UIDefaults.getUIError: " + msg);  }  /**   * Returns the {@link ComponentUI} for the specified {@link JComponent}.   *   * @param target the component for which the ComponentUI is requested   *   * @return the {@link ComponentUI} for the specified {@link JComponent}   */  public ComponentUI getUI(JComponent target)  {    String classId = target.getUIClassID ();    Class cls = getUIClass (classId);    if (cls == null)      {        getUIError ("failed to locate UI class:" + classId);        return null;      }    Method factory;    try       {        factory = cls.getMethod ("createUI", new Class[] { JComponent.class } );      }    catch (NoSuchMethodException nme)      {        getUIError ("failed to locate createUI method on " + cls.toString ());        return null;      }    try      {        return (ComponentUI) factory.invoke (null, new Object[] { target });      }    catch (java.lang.reflect.InvocationTargetException ite)      {        getUIError ("InvocationTargetException ("+ ite.getTargetException() 		    +") calling createUI(...) on " + cls.toString ());        return null;              }    catch (Exception e)      {        getUIError ("exception calling createUI(...) on " + cls.toString ());        return null;              }  }  /**   * Adds a {@link PropertyChangeListener} to this UIDefaults map.   * Registered PropertyChangeListener are notified when values   * are beeing put into this UIDefaults map.   *   * @param listener the PropertyChangeListener to add   */  public void addPropertyChangeListener(PropertyChangeListener listener)  {    propertyChangeSupport.addPropertyChangeListener(listener);  }  /**   * Removes a PropertyChangeListener from this UIDefaults map.   *   * @param listener the PropertyChangeListener to remove   */  public void removePropertyChangeListener(PropertyChangeListener listener)  {    propertyChangeSupport.removePropertyChangeListener(listener);  }  /**   * Returns an array of all registered PropertyChangeListeners.   *   * @return all registered PropertyChangeListeners   */  public PropertyChangeListener[] getPropertyChangeListeners()  {    return propertyChangeSupport.getPropertyChangeListeners();  }  /**   * Fires a PropertyChangeEvent.   *   * @param property the property name   * @param oldValue the old value   * @param newValue the new value   */  protected void firePropertyChange(String property,				    Object oldValue, Object newValue)  {    propertyChangeSupport.firePropertyChange(property, oldValue, newValue);  }  /**   * Adds a ResourceBundle for localized values.   *   * @param name the name of the ResourceBundle to add   */  public void addResourceBundle(String name)  {    bundles.addFirst(name);  }  /**   * Removes a ResourceBundle.   *   * @param name the name of the ResourceBundle to remove   */  public void removeResourceBundle(String name)  {    bundles.remove(name);  }  /**   * Sets the current locale to <code>loc</code>.   *   * @param loc the Locale to be set   */  public void setDefaultLocale(Locale loc)  {    defaultLocale = loc;  }  /**   * Returns the current default locale.   *   * @return the current default locale   */  public Locale getDefaultLocale()  {    return defaultLocale;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -