Java Code Examples for javax.swing.plaf.synth.SynthLookAndFeel#getStyle()
The following examples show how to use
javax.swing.plaf.synth.SynthLookAndFeel#getStyle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SeaGlassViewportUI.java From seaglass with Apache License 2.0 | 6 votes |
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(); }
Example 2
Source File: SeaGlassLookAndFeel.java From seaglass with Apache License 2.0 | 6 votes |
/** * 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; }
Example 3
Source File: bug8081411.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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); }
Example 4
Source File: LafManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
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); } } } }
Example 5
Source File: MainPanel.java From java-swing-tips with MIT License | 4 votes |
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); }
Example 6
Source File: ThemeValue.java From netbeans with Apache License 2.0 | 4 votes |
private static SynthStyle getSynthStyle (Region region) { return SynthLookAndFeel.getStyle(getDummyButton(), region); }
Example 7
Source File: MainPanel.java From java-swing-tips with MIT License | 4 votes |
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); }
Example 8
Source File: MainPanel.java From java-swing-tips with MIT License | 4 votes |
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); }
Example 9
Source File: MainPanel.java From java-swing-tips with MIT License | 4 votes |
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); }
Example 10
Source File: MainPanel.java From java-swing-tips with MIT License | 4 votes |
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); }
Example 11
Source File: NimbusLookAndFeel.java From JDKSourceCode1.8 with MIT License | 2 votes |
/** * 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); }
Example 12
Source File: NimbusLookAndFeel.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * 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); }
Example 13
Source File: NimbusLookAndFeel.java From jdk8u-jdk with GNU General Public License v2.0 | 2 votes |
/** * 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); }
Example 14
Source File: NimbusLookAndFeel.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * 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); }
Example 15
Source File: NimbusLookAndFeel.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * 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); }
Example 16
Source File: NimbusLookAndFeel.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * 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); }
Example 17
Source File: NimbusLookAndFeel.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * 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); }
Example 18
Source File: NimbusLookAndFeel.java From jdk8u-jdk with GNU General Public License v2.0 | 2 votes |
/** * 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); }
Example 19
Source File: NimbusLookAndFeel.java From TencentKona-8 with GNU General Public License v2.0 | 2 votes |
/** * 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); }
Example 20
Source File: NimbusLookAndFeel.java From dragonwell8_jdk with GNU General Public License v2.0 | 2 votes |
/** * 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); }