本文整理汇总了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));
}
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
}
}
}
示例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);
}
}
示例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);
}
}
示例8: getSynthStyle
import javax.swing.plaf.synth.SynthLookAndFeel; //导入方法依赖的package包/类
private static SynthStyle getSynthStyle (Region region) {
return SynthLookAndFeel.getStyle(getDummyButton(), region);
}
示例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);
}
示例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);
}