当前位置: 首页>>代码示例>>Java>>正文


Java LookAndFeel类代码示例

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


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


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