當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。