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


Java SynthLookAndFeel.getStyle方法代码示例

本文整理汇总了Java中javax.swing.plaf.synth.SynthLookAndFeel.getStyle方法的典型用法代码示例。如果您正苦于以下问题:Java SynthLookAndFeel.getStyle方法的具体用法?Java SynthLookAndFeel.getStyle怎么用?Java SynthLookAndFeel.getStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.plaf.synth.SynthLookAndFeel的用法示例。


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

示例1: patchGtkDefaults

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private static void patchGtkDefaults(UIDefaults defaults) {
  if (!UIUtil.isUnderGTKLookAndFeel()) return;

  Map<String, Icon> map = ContainerUtil.newHashMap(
    Arrays.asList("OptionPane.errorIcon", "OptionPane.informationIcon", "OptionPane.warningIcon", "OptionPane.questionIcon"),
    Arrays.asList(AllIcons.General.ErrorDialog, AllIcons.General.InformationDialog, AllIcons.General.WarningDialog, AllIcons.General.QuestionDialog));
  // GTK+ L&F keeps icons hidden in style
  SynthStyle style = SynthLookAndFeel.getStyle(new JOptionPane(""), Region.DESKTOP_ICON);
  for (String key : map.keySet()) {
    if (defaults.get(key) != null) continue;

    Object icon = style == null ? null : style.get(null, key);
    defaults.put(key, icon instanceof Icon ? icon : map.get(key));
  }

  Color fg = defaults.getColor("Label.foreground");
  Color bg = defaults.getColor("Label.background");
  if (fg != null && bg != null) {
    defaults.put("Label.disabledForeground", UIUtil.mix(fg, bg, 0.5));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:LafManagerImpl.java

示例2: updateStyle

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
/**
 * A convience method that will reset the Style of StyleContext if
 * necessary.
 *
 * @param  context the SynthContext corresponding to the current state.
 * @param  ui      the UI delegate.
 *
 * @return the new, updated style.
 */
public static SynthStyle updateStyle(SeaGlassContext context, SeaglassUI ui) {
    SynthStyle newStyle = SynthLookAndFeel.getStyle(context.getComponent(), context.getRegion());
    SynthStyle oldStyle = context.getStyle();

    if (newStyle != oldStyle) {

        if (oldStyle != null) {
            oldStyle.uninstallDefaults(context);
        }

        context.setStyle(newStyle);
        if (newStyle instanceof SeaGlassStyle) {
            ((SeaGlassStyle) newStyle).installDefaults(context, ui);
        }
    }

    return newStyle;
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:28,代码来源:SeaGlassLookAndFeel.java

示例3: updateStyle

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private void updateStyle(JComponent c) {
    SeaGlassContext context = getContext(c, ENABLED);

    // Note: JViewport is special cased as it does not allow for
    // a border to be set. JViewport.setBorder is overriden to throw
    // an IllegalArgumentException. Refer to SynthScrollPaneUI for
    // details of this.
    SynthStyle newStyle = SynthLookAndFeel.getStyle(context.getComponent(), context.getRegion());
    SynthStyle oldStyle = context.getStyle();

    if (newStyle != oldStyle) {
        if (oldStyle != null) {
            oldStyle.uninstallDefaults(context);
        }
        context.setStyle(newStyle);
        newStyle.installDefaults(context);
    }
    this.style = newStyle;
    context.dispose();
}
 
开发者ID:khuxtable,项目名称:seaglass,代码行数:21,代码来源:SeaGlassViewportUI.java

示例4: testSynthIcon

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private static void testSynthIcon() {

        if (!checkAndSetNimbusLookAndFeel()) {
            return;
        }

        JMenuItem menu = new JMenuItem();
        Icon subMenuIcon = UIManager.getIcon("Menu.arrowIcon");

        if (!(subMenuIcon instanceof SynthIcon)) {
            throw new RuntimeException("Icon is not a SynthIcon!");
        }

        Region region = SynthLookAndFeel.getRegion(menu);
        SynthStyle style = SynthLookAndFeel.getStyle(menu, region);
        SynthContext synthContext = new SynthContext(menu, region, style, SynthConstants.ENABLED);

        int width = SynthGraphicsUtils.getIconWidth(subMenuIcon, synthContext);
        int height = SynthGraphicsUtils.getIconHeight(subMenuIcon, synthContext);
        paintAndCheckIcon(subMenuIcon, synthContext, width, height);

        int newWidth = width * 17;
        int newHeight = height * 37;
        Icon centeredIcon = new CenteredSynthIcon((SynthIcon) subMenuIcon,
                newWidth, newHeight);
        paintAndCheckIcon(centeredIcon, synthContext, newWidth, newHeight);
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:bug8081411.java

示例5: patchOptionPaneIcons

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private static void patchOptionPaneIcons(final UIDefaults defaults) {
  if (UIUtil.isUnderGTKLookAndFeel() && defaults.get(ourOptionPaneIconKeys[0]) == null) {
    // GTK+ L&F keeps icons hidden in style
    final SynthStyle style = SynthLookAndFeel.getStyle(new JOptionPane(""), Region.DESKTOP_ICON);
    if (style != null) {
      for (final String key : ourOptionPaneIconKeys) {
        final Object icon = style.get(null, key);
        if (icon != null) defaults.put(key, icon);
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:LafManagerImpl.java

示例6: getTabInsets

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private Insets getTabInsets() {
	Insets i = UIManager.getInsets("TabbedPane.tabInsets");
	if (i != null) {
		return i;
	} else {
		SynthStyle style = SynthLookAndFeel.getStyle(this, Region.TABBED_PANE_TAB);
		SynthContext context = new SynthContext(this, Region.TABBED_PANE_TAB, style, SynthConstants.ENABLED);
		return style.getInsets(context, null);
	}
}
 
开发者ID:zeromancer,项目名称:mangawatcher,代码行数:11,代码来源:GuiTabbedPane.java

示例7: getTabAreaInsets

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private Insets getTabAreaInsets() {
	Insets i = UIManager.getInsets("TabbedPane.tabAreaInsets");
	if (i != null) {
		return i;
	} else {
		SynthStyle style = SynthLookAndFeel.getStyle(this, Region.TABBED_PANE_TAB_AREA);
		SynthContext context = new SynthContext(this, Region.TABBED_PANE_TAB_AREA, style, SynthConstants.ENABLED);
		return style.getInsets(context, null);
	}
}
 
开发者ID:zeromancer,项目名称:mangawatcher,代码行数:11,代码来源:GuiTabbedPane.java

示例8: getSynthStyle

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private static SynthStyle getSynthStyle (Region region) {
    return SynthLookAndFeel.getStyle(getDummyButton(), region);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:ThemeValue.java

示例9: getStyle

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
/**
 * Gets the style associated with the given component and region. This
 * will never return null. If an appropriate component and region cannot
 * be determined, then a default style is returned.
 *
 * @param c a non-null reference to a JComponent
 * @param r a non-null reference to the region of the component c
 * @return a non-null reference to a NimbusStyle.
 */
public static NimbusStyle getStyle(JComponent c, Region r) {
    return (NimbusStyle)SynthLookAndFeel.getStyle(c, r);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:NimbusLookAndFeel.java

示例10: getStyle

import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
/**
 * Gets the style associated with the given component and region. This
 * will never return null. If an appropriate component and region cannot
 * be determined, then a default style is returned.
 * 
 * @param c a non-null reference to a JComponent
 * @param r a non-null reference to the region of the component c
 * @return a non-null reference to a NimbusStyle.
 */
public static OpaqueNimbusStyle getStyle(JComponent c, Region r) {
    return (OpaqueNimbusStyle)SynthLookAndFeel.getStyle(c, r);
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:13,代码来源:OpaqueNimbusLookAndFeel.java


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