當前位置: 首頁>>代碼示例>>Java>>正文


Java LookAndFeel.getDefaults方法代碼示例

本文整理匯總了Java中javax.swing.LookAndFeel.getDefaults方法的典型用法代碼示例。如果您正苦於以下問題:Java LookAndFeel.getDefaults方法的具體用法?Java LookAndFeel.getDefaults怎麽用?Java LookAndFeel.getDefaults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.LookAndFeel的用法示例。


在下文中一共展示了LookAndFeel.getDefaults方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initUIDefaults

import javax.swing.LookAndFeel; //導入方法依賴的package包/類
static void initUIDefaults() {
    try {
        // Load Defaults from MotifLookAndFeel

        // This dummy load is necessary to get SystemColor initialized. !!!!!!
        Color c = SystemColor.text;

        LookAndFeel lnf = new XAWTLookAndFeel();
        uidefaults = lnf.getDefaults();
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:16,代碼來源:XToolkit.java

示例2: createUIs

import javax.swing.LookAndFeel; //導入方法依賴的package包/類
/**
 * Creates the UI delegates for the <code>target</code> component and
 * returns a multiplexing UI delegate (<code>mui</code>) if there are
 * multiple delegates.
 *
 * @param mui  a multiplexing UI delegate appropriate for the component.
 * @param uis  a vector into which the UI delegates will be added.
 * @param target  the target component.
 *
 * @return A UI delegate.
 */
public static ComponentUI createUIs(ComponentUI mui, Vector uis,
                                    JComponent target)
{
  // get primary UI delegate for 'target', and add it to uis
  ComponentUI ui = null;
  LookAndFeel primary = UIManager.getLookAndFeel();
  if (primary != null)
  {
    ui = UIManager.getUI(target);
    uis.add(ui);
  }
  // for any auxiliary look and feels in use, get the UI delegate and add
  // it to uis
  LookAndFeel[] auxlafs = UIManager.getAuxiliaryLookAndFeels();
  for (int i = 0; i < auxlafs.length; i++)
  {
    LookAndFeel auxlaf = auxlafs[i];
    // FIXME: here I call getDefaults() to get the UI delegate from the
    // auxiliary look and feel.  But getDefaults() creates a new set of
    // defaults every time it is called, which is wasteful.  Unfortunately
    // I cannot find another way to get the UI delegate, so I'm doing it
    // anyway...
    UIDefaults defaults = auxlaf.getDefaults();
    ui = defaults.getUI(target);
    if (ui != null)
      uis.add(ui);
  }
  // if uis contains more than 1 delegate, return mui, otherwise return
  // the primary delegate
  if (uis.size() > 1)
    return mui;
  else
    return ui;
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:46,代碼來源:MultiLookAndFeel.java


注:本文中的javax.swing.LookAndFeel.getDefaults方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。