当前位置: 首页>>代码示例>>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;未经允许,请勿转载。