javax.swing.plaf.synth.SynthLookAndFeel#getStyle ( )源码实例Demo

下面列出了javax.swing.plaf.synth.SynthLookAndFeel#getStyle ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: seaglass   文件: SeaGlassLookAndFeel.java
/**
 * 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;
}
 
源代码2 项目: seaglass   文件: SeaGlassViewportUI.java
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();
}
 
源代码3 项目: openjdk-jdk9   文件: bug8081411.java
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);
    }
 
源代码4 项目: consulo   文件: LafManagerImpl.java
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);
      }
    }
  }
}
 
源代码5 项目: java-swing-tips   文件: MainPanel.java
private Insets getSynthInsets(Region region) {
  SynthStyle style = SynthLookAndFeel.getStyle(this, region);
  SynthContext context = new SynthContext(this, region, style, SynthConstants.ENABLED);
  return style.getInsets(context, null);
}
 
源代码6 项目: java-swing-tips   文件: MainPanel.java
private Insets getSynthInsets(Region region) {
  SynthStyle style = SynthLookAndFeel.getStyle(this, region);
  SynthContext context = new SynthContext(this, region, style, SynthConstants.ENABLED);
  return style.getInsets(context, null);
}
 
源代码7 项目: netbeans   文件: ThemeValue.java
private static SynthStyle getSynthStyle (Region region) {
    return SynthLookAndFeel.getStyle(getDummyButton(), region);
}
 
源代码8 项目: java-swing-tips   文件: MainPanel.java
private Insets getSynthInsets(Region region) {
  SynthStyle style = SynthLookAndFeel.getStyle(this, region);
  SynthContext context = new SynthContext(this, region, style, SynthConstants.ENABLED);
  return style.getInsets(context, null);
}
 
源代码9 项目: java-swing-tips   文件: MainPanel.java
private Insets getSynthInsets(Region region) {
  SynthStyle style = SynthLookAndFeel.getStyle(this, region);
  SynthContext context = new SynthContext(this, region, style, SynthConstants.ENABLED);
  return style.getInsets(context, null);
}
 
源代码10 项目: java-swing-tips   文件: MainPanel.java
private Insets getSynthInsets(Region region) {
  SynthStyle style = SynthLookAndFeel.getStyle(this, region);
  SynthContext context = new SynthContext(this, region, style, SynthConstants.ENABLED);
  return style.getInsets(context, null);
}
 
源代码11 项目: dragonwell8_jdk   文件: NimbusLookAndFeel.java
/**
 * 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);
}
 
源代码12 项目: TencentKona-8   文件: NimbusLookAndFeel.java
/**
 * 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);
}
 
源代码13 项目: jdk8u60   文件: NimbusLookAndFeel.java
/**
 * 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);
}
 
源代码14 项目: JDKSourceCode1.8   文件: NimbusLookAndFeel.java
/**
 * 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);
}
 
源代码15 项目: openjdk-jdk9   文件: NimbusLookAndFeel.java
/**
 * 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);
}
 
源代码16 项目: jdk8u-jdk   文件: NimbusLookAndFeel.java
/**
 * 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);
}
 
源代码17 项目: hottub   文件: NimbusLookAndFeel.java
/**
 * 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);
}
 
源代码18 项目: openjdk-8-source   文件: NimbusLookAndFeel.java
/**
 * 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);
}
 
源代码19 项目: openjdk-8   文件: NimbusLookAndFeel.java
/**
 * 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);
}
 
源代码20 项目: jdk8u-jdk   文件: NimbusLookAndFeel.java
/**
 * 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);
}