• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LookAndFeel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: applyNbSkin

import javax.swing.LookAndFeel; //导入依赖的package包/类
static void applyNbSkin() {
    LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
    String name = lookAndFeel.getName();
    switch (name) {
        case "Mac OS X":
            name = "mac";
            break;
        case "Metal":
            name = "metal";
            break;
        case "GTK look and feel":
            name = "gtk";
            break;
        case "Nimbus":
            name = "nimbus";
            break;
        case "Windows":
            name = "win";
            break;
        case "Darcula":
            name = "darcula";
            break;
    }
    final String resource = "nbres:/org/netbeans/modules/htmlui/css/wizard-" + name + ".css";
    loadCss(resource);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:NbBrowsers.java


示例2: getLFHeightAdjustment

import javax.swing.LookAndFeel; //导入依赖的package包/类
private static int getLFHeightAdjustment() {
    LookAndFeel lf = UIManager.getLookAndFeel();
    String lfID = lf.getID();
    logger.fine("createSingleLineEditor(): current L&F = '"+lfID+"'");
    if ("Metal".equals(lfID)) {
        return 0;
    }
    if ("GTK".equals(lfID)) {
        return 2;
    }
    if ("Motif".equals(lfID)) {
        return 3;
    }
    if ("Nimbus".equals(lfID)) {
        return 0;
    }
    if ("Aqua".equals(lfID)) {
        return -2;
    }
    return 0;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:Utilities.java


示例3: isDarkLookAndFeel

import javax.swing.LookAndFeel; //导入依赖的package包/类
private boolean isDarkLookAndFeel() {
    String className = NbPreferences.root().node( "laf" ).get( "laf", null );
    if( null == className )
        return false;

    ClassLoader loader = Lookup.getDefault().lookup( ClassLoader.class );
    if( null == loader )
        loader = ClassLoader.getSystemClassLoader();

    try {
        Class klazz = loader.loadClass( className );
        LookAndFeel laf = ( LookAndFeel ) klazz.newInstance();
        return laf.getDefaults().getBoolean( "nb.dark.theme" ); //NOI18N
    } catch( Exception e ) {
        //ignore
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:LafPanel.java


示例4: paintComponent

import javax.swing.LookAndFeel; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void paintComponent(Graphics graphics) {
	// Surchargée pour dessiner le fond avec gradient
	final LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
	final String lafName = lookAndFeel != null ? lookAndFeel.getName() : null;
	if ("Substance".equals(lafName)) {
		super.paintComponent(graphics); // le gradient fonctionne mal en substance ?
	}

	final Color startColor = getBackground();
	final Color endColor = GRADIENT_COLOR;
	final int w = getWidth();
	final int h = getHeight();

	// l'image du gradient pourrait être mise en cache, mais ce n'est pas grave
	final Paint paint = new GradientPaint(0, h / 2f, startColor, 1, h, endColor, false);
	final Graphics2D graphix = (Graphics2D) graphics.create();
	graphix.setPaint(paint);
	graphix.fillRect(0, 0, w, h);
	graphix.dispose();
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:23,代码来源:DeadCodeDetectorUI.java


示例5: updateUI

import javax.swing.LookAndFeel; //导入依赖的package包/类
/**
 * Overridden to message super and forward the method to the tree. Since
 * the tree is not actually in the component hierarchy it will never receive
 * this unless we forward it in this manner.
 */
//----------//
// updateUI //
//----------//
@Override
public void updateUI ()
{
    super.updateUI();

    if (tree != null) {
        tree.updateUI();
    }

    // Use the tree's default foreground and background colors in the
    // table.
    LookAndFeel.installColorsAndFont(this, "Tree.background", "Tree.foreground", "Tree.font");
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:22,代码来源:JTreeTable.java


示例6: addBasicDefaults

import javax.swing.LookAndFeel; //导入依赖的package包/类
protected void addBasicDefaults(LookAndFeelAddons addon, List defaults) {
  defaults.add(JTipOfTheDay.uiClassID);
  defaults.add(BasicTipOfTheDayUI.class.getName());

  defaults.add("TipOfTheDay.font");
  defaults.add(UIManager.getFont("TextPane.font"));

  defaults.add("TipOfTheDay.tipFont");
  defaults.add(UIManager.getFont("Label.font").deriveFont(Font.BOLD, 13f));

  defaults.add("TipOfTheDay.background");
  defaults.add(new ColorUIResource(Color.white));

  defaults.add("TipOfTheDay.icon");
  defaults.add(LookAndFeel.makeIcon(BasicTipOfTheDayUI.class,
    "TipOfTheDay24.gif"));

  defaults.add("TipOfTheDay.border");
  defaults.add(new BorderUIResource(BorderFactory.createLineBorder(new Color(
    117, 117, 117))));

  addResource(defaults,
    "com.l2fprod.common.swing.plaf.basic.resources.TipOfTheDay");
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:25,代码来源:JTipOfTheDayAddon.java


示例7: addWindowsDefaults

import javax.swing.LookAndFeel; //导入依赖的package包/类
protected void addWindowsDefaults(LookAndFeelAddons addon, List defaults) {
  super.addWindowsDefaults(addon, defaults);

  defaults.add(JTipOfTheDay.uiClassID);
  defaults.add(WindowsTipOfTheDayUI.class.getName());

  defaults.add("TipOfTheDay.background");
  defaults.add(new ColorUIResource(128, 128, 128));

  defaults.add("TipOfTheDay.font");
  defaults.add(UIManager.getFont("Label.font").deriveFont(13f));

  defaults.add("TipOfTheDay.icon");
  defaults.add(LookAndFeel.makeIcon(WindowsTipOfTheDayUI.class,
    "tipoftheday.png"));

  defaults.add("TipOfTheDay.border");
  defaults
    .add(new BorderUIResource(new WindowsTipOfTheDayUI.TipAreaBorder()));

  addResource(defaults,
    "com.l2fprod.common.swing.plaf.windows.resources.TipOfTheDay");
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:24,代码来源:JTipOfTheDayAddon.java


示例8: installDefaults

import javax.swing.LookAndFeel; //导入依赖的package包/类
protected void installDefaults() {
  group.setOpaque(true);
  group.setBorder(createPaneBorder());
  ((JComponent)group.getContentPane()).setBorder(createContentPaneBorder());

  LookAndFeel.installColorsAndFont(
    group,
    "TaskPaneGroup.background",
    "TaskPaneGroup.foreground",
    "TaskPaneGroup.font");

  LookAndFeel.installColorsAndFont(
    (JComponent)group.getContentPane(),
    "TaskPaneGroup.background",
    "TaskPaneGroup.foreground",
    "TaskPaneGroup.font");    
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:18,代码来源:BasicTaskPaneGroupUI.java


示例9: installDefaults

import javax.swing.LookAndFeel; //导入依赖的package包/类
/**
 * This method installs defaults for the JOptionPane.
 */
protected void installDefaults()
{
  LookAndFeel.installColorsAndFont(optionPane, "OptionPane.background",
                                   "OptionPane.foreground",
                                   "OptionPane.font");
  LookAndFeel.installBorder(optionPane, "OptionPane.border");
  optionPane.setOpaque(true);

  minimumSize = UIManager.getDimension("OptionPane.minimumSize");

  // FIXME: Image icons don't seem to work properly right now.
  // Once they do, replace the synthetic icons with these ones.

  /*
  warningIcon = (IconUIResource) defaults.getIcon("OptionPane.warningIcon");
  infoIcon = (IconUIResource) defaults.getIcon("OptionPane.informationIcon");
  errorIcon = (IconUIResource) defaults.getIcon("OptionPane.errorIcon");
  questionIcon = (IconUIResource) defaults.getIcon("OptionPane.questionIcon");
  */
}
 
开发者ID:vilie,项目名称:javify,代码行数:24,代码来源:BasicOptionPaneUI.java


示例10: installDefaults

import javax.swing.LookAndFeel; //导入依赖的package包/类
/**
 * Initializes any default properties that this UI has from the defaults for
 * the Basic look and feel.
 */
protected void installDefaults()
{

  LookAndFeel.installBorder(menuItem, "Menu.border");
  LookAndFeel.installColorsAndFont(menuItem, "Menu.background",
                                   "Menu.foreground", "Menu.font");
  menuItem.setMargin(UIManager.getInsets("Menu.margin"));
  acceleratorFont = UIManager.getFont("Menu.acceleratorFont");
  acceleratorForeground = UIManager.getColor("Menu.acceleratorForeground");
  acceleratorSelectionForeground = UIManager.getColor("Menu.acceleratorSelectionForeground");
  selectionBackground = UIManager.getColor("Menu.selectionBackground");
  selectionForeground = UIManager.getColor("Menu.selectionForeground");
  arrowIcon = UIManager.getIcon("Menu.arrowIcon");
  oldBorderPainted = UIManager.getBoolean("Menu.borderPainted");
  ((JMenu) menuItem).setDelay(200);
}
 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:BasicMenuUI.java


示例11: updateUI

import javax.swing.LookAndFeel; //导入依赖的package包/类
public void updateUI()
   {
super.updateUI();
LookAndFeel currentLookAndFeel = UIManager.getLookAndFeel();
if (currentLookAndFeel != null) {
    String current = currentLookAndFeel.getClass().getName();
    for (Enumeration<AbstractButton> buttons = getLookAndFeelGroup().getElements();
	 buttons.hasMoreElements();) {
	AbstractButton button = buttons.nextElement();
	if (button.getActionCommand().equals(current)) {
	    button.setSelected(true);
	    break;
	}
    }
}
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:17,代码来源:LookAndFeelMenuItem.java


示例12: updateLookAndFeels

import javax.swing.LookAndFeel; //导入依赖的package包/类
protected void updateLookAndFeels()
   {
clearButtons();
LookAndFeel currentLookAndFeel = UIManager.getLookAndFeel();
String current = currentLookAndFeel == null ? "" : currentLookAndFeel.getName();
LookAndFeelInfo[] infoArray = UIManager.getInstalledLookAndFeels();
if (infoArray == null || infoArray.length == 0) {
    return;
}

for (LookAndFeelInfo info : infoArray) {
    JRadioButtonMenuItem button = new JRadioButtonMenuItem(info.getName());
    button.setActionCommand(info.getClassName());
    if (info.getName().equals(current))
	button.setSelected(true);
    addButton(button);
}
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:19,代码来源:LookAndFeelMenuItem.java


示例13: installDefaults

import javax.swing.LookAndFeel; //导入依赖的package包/类
public void installDefaults(AbstractButton b)
{
    super.installDefaults(b);

    LookAndFeel.installProperty(b, "rolloverEnabled", Boolean.TRUE);

    LookAndFeel.installProperty(b, "opaque", Boolean.FALSE);

    btnColorInfo = (LuckButtonColorInfo) UIManager.get(LuckButtonUIBundle.COLOR_INFO);

    // 使用配置颜色替换默认字体颜色
    // Replace the default font color with the configured color
    if(b.getForeground() instanceof ColorUIResource)
    {
        b.setForeground(btnColorInfo.getFontColor());
    }
    
    listener = new ButtonPropertyChangeListener();
    
    b.addPropertyChangeListener(listener);
}
 
开发者ID:freeseawind,项目名称:littleluck,代码行数:22,代码来源:LuckButtonUI.java


示例14: installKeyboardActionsImpl

import javax.swing.LookAndFeel; //导入依赖的package包/类
/**
 * Called by the KeyboardHandler when a popup is made visible.
 */
void installKeyboardActionsImpl()
{
  Object[] bindings;
  if (popupMenu.getComponentOrientation().isLeftToRight())
    {
      bindings = (Object[])
           SharedUIDefaults.get("PopupMenu.selectedWindowInputMapBindings");
    }
  else
    {
      bindings = (Object[]) SharedUIDefaults.get
                    ("PopupMenu.selectedWindowInputMapBindings.RightToLeft");
    }
  InputMap inputMap = LookAndFeel.makeComponentInputMap(popupMenu, bindings);
  SwingUtilities.replaceUIInputMap(popupMenu,
                                   JComponent.WHEN_IN_FOCUSED_WINDOW,
                                   inputMap);

  // Install ActionMap.
  SwingUtilities.replaceUIActionMap(popupMenu, getActionMap());
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:BasicPopupMenuUI.java


示例15: installDefaults

import javax.swing.LookAndFeel; //导入依赖的package包/类
/**
 * This method installs the defaults that are defined in the Basic look and
 * feel for this {@link JMenuItem}.
 */
protected void installDefaults()
{
  String prefix = getPropertyPrefix();
  LookAndFeel.installBorder(menuItem, prefix + ".border");
  LookAndFeel.installColorsAndFont(menuItem, prefix + ".background",
                                   prefix + ".foreground", prefix + ".font");
  menuItem.setMargin(UIManager.getInsets(prefix + ".margin"));
  acceleratorFont = UIManager.getFont(prefix + ".acceleratorFont");
  acceleratorForeground = UIManager.getColor(prefix
      + ".acceleratorForeground");
  acceleratorSelectionForeground = UIManager.getColor(prefix
      + ".acceleratorSelectionForeground");
  selectionBackground = UIManager.getColor(prefix + ".selectionBackground");
  selectionForeground = UIManager.getColor(prefix + ".selectionForeground");
  acceleratorDelimiter = UIManager.getString(prefix + ".acceleratorDelimiter");
  checkIcon = UIManager.getIcon(prefix + ".checkIcon");

  menuItem.setHorizontalTextPosition(SwingConstants.TRAILING);
  menuItem.setHorizontalAlignment(SwingConstants.LEADING);
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:BasicMenuItemUI.java


示例16: propertyChange

import javax.swing.LookAndFeel; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent event)
{
  JRootPane source = (JRootPane) event.getSource();
  String propertyName = event.getPropertyName();
  if (propertyName.equals("defaultButton"))
    {
      Object newValue = event.getNewValue();
      InputMap im =
        SwingUtilities.getUIInputMap(source,
                                     JComponent.WHEN_IN_FOCUSED_WINDOW);
      if (newValue != null)
        {
          Object[] keybindings = (Object[]) UIManager.get(
              "RootPane.defaultButtonWindowKeyBindings");
          LookAndFeel.loadKeyBindings(im, keybindings);
        }
      else
        {
          im.clear();
        }
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:23,代码来源:BasicRootPaneUI.java


示例17: addWindowsDefaults

import javax.swing.LookAndFeel; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
  super.addWindowsDefaults(addon, defaults);

  Font font = UIManagerExt.getSafeFont("Label.font",
          new Font("Dialog", Font.PLAIN, 12));
  font = font.deriveFont(13f);
  
  defaults.add(JXCategory.uiClassID, WindowsTipOfTheDayUI.class.getName());
  defaults.add("Category.background", new ColorUIResource(Color.GRAY));
  defaults.add("Category.font", new FontUIResource(font));
  defaults.add("Category.icon",
          LookAndFeel.makeIcon(WindowsTipOfTheDayUI.class, "resources/tipoftheday.png"));
  defaults.add("Category.border" ,new BorderUIResource(new WindowsTipOfTheDayUI.TipAreaBorder()));

  UIManagerExt.addResourceBundle(
      "org.jdesktop.swingx.plaf.windows.resources.TipOfTheDay");
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:22,代码来源:CategoryAddon.java


示例18: addBasicDefaults

import javax.swing.LookAndFeel; //导入依赖的package包/类
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
    super.addBasicDefaults(addon, defaults);
    
    Font font = UIManagerExt.getSafeFont("Label.font", new Font("Dialog", Font.PLAIN, 12));
    font = font.deriveFont(Font.BOLD, 13f);
    
    defaults.add(JXTipOfTheDay.uiClassID, BasicTipOfTheDayUI.class.getName());
    defaults.add("TipOfTheDay.font", UIManagerExt.getSafeFont("TextPane.font",
              new FontUIResource("Serif", Font.PLAIN, 12)));
    defaults.add("TipOfTheDay.tipFont", new FontUIResource(font));
    defaults.add("TipOfTheDay.background", new ColorUIResource(Color.WHITE));
    defaults.add("TipOfTheDay.icon",
            LookAndFeel.makeIcon(BasicTipOfTheDayUI.class, "resources/TipOfTheDay24.gif"));
    defaults.add("TipOfTheDay.border", new BorderUIResource(
            BorderFactory.createLineBorder(new Color(117, 117, 117))));

  UIManagerExt.addResourceBundle(
          "org.jdesktop.swingx.plaf.basic.resources.TipOfTheDay");
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:21,代码来源:TipOfTheDayAddon.java


示例19: addWindowsDefaults

import javax.swing.LookAndFeel; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void addWindowsDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
  super.addWindowsDefaults(addon, defaults);

  Font font = UIManagerExt.getSafeFont("Label.font",
          new Font("Dialog", Font.PLAIN, 12));
  font = font.deriveFont(13f);
  
  defaults.add(JXTipOfTheDay.uiClassID, WindowsTipOfTheDayUI.class.getName());
  defaults.add("TipOfTheDay.background", new ColorUIResource(Color.GRAY));
  defaults.add("TipOfTheDay.font", new FontUIResource(font));
  defaults.add("TipOfTheDay.icon",
          LookAndFeel.makeIcon(WindowsTipOfTheDayUI.class, "resources/tipoftheday.png"));
  defaults.add("TipOfTheDay.border" ,new BorderUIResource(new WindowsTipOfTheDayUI.TipAreaBorder()));

  UIManagerExt.addResourceBundle(
      "org.jdesktop.swingx.plaf.windows.resources.TipOfTheDay");
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:22,代码来源:TipOfTheDayAddon.java


示例20: installDefaults

import javax.swing.LookAndFeel; //导入依赖的package包/类
/**
 * This method installs the defaults given by the Look and Feel.
 */
protected void installDefaults()
{
  LookAndFeel.installColors(splitPane, "SplitPane.background",
                            "SplitPane.foreground");
  LookAndFeel.installBorder(splitPane, "SplitPane.border");
  divider = createDefaultDivider();
  divider.setBorder(UIManager.getBorder("SplitPaneDivider.border"));
  resetLayoutManager();
  nonContinuousLayoutDivider = createDefaultNonContinuousLayoutDivider();
  splitPane.add(divider, JSplitPane.DIVIDER);

  // There is no need to add the nonContinuousLayoutDivider.
  dividerSize = UIManager.getInt("SplitPane.dividerSize");
  splitPane.setDividerSize(dividerSize);
  divider.setDividerSize(dividerSize);
  splitPane.setOpaque(true);
}
 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:BasicSplitPaneUI.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ScrolledComposite类代码示例发布时间:2022-05-20
下一篇:
Java MaterialData类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap