Search in sources :

Example 1 with SynthContext

use of javax.swing.plaf.synth.SynthContext in project jdk8u_jdk by JetBrains.

the class bug6923305 method main.

public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new SynthLookAndFeel());
    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            JSlider slider = new JSlider();
            slider.setUI(new SynthSliderUI(slider) {

                @Override
                protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) {
                    throw new RuntimeException("Test failed: the SynthSliderUI.paintTrack was invoked");
                }
            });
            slider.setPaintTrack(false);
            slider.setSize(slider.getPreferredSize());
            BufferedImage bufferedImage = new BufferedImage(slider.getWidth(), slider.getHeight(), BufferedImage.TYPE_INT_ARGB);
            slider.paint(bufferedImage.getGraphics());
        }
    });
}
Also used : SynthLookAndFeel(javax.swing.plaf.synth.SynthLookAndFeel) SynthSliderUI(javax.swing.plaf.synth.SynthSliderUI) BufferedImage(java.awt.image.BufferedImage) SynthContext(javax.swing.plaf.synth.SynthContext)

Example 2 with SynthContext

use of javax.swing.plaf.synth.SynthContext in project intellij-community by JetBrains.

the class GtkMenuItemUI method getCheckIconFromContext.

private static Icon getCheckIconFromContext(final SynthMenuItemUI ui, final JCheckBoxMenuItem item) {
    if (myCachedCheckIcon == null) {
        SynthContext context = ui.getContext(item);
        myCachedCheckIcon = context.getStyle().getIcon(context, "CheckBoxMenuItem.checkIcon");
    }
    return myCachedCheckIcon;
}
Also used : SynthContext(javax.swing.plaf.synth.SynthContext)

Example 3 with SynthContext

use of javax.swing.plaf.synth.SynthContext in project intellij-community by JetBrains.

the class GtkPaintingUtil method paintDisabledText.

public static void paintDisabledText(final SynthUI originalUI, final Graphics g, final JMenuItem menuItem, final Rectangle textRect, final String text) {
    final FontMetrics fm = SwingUtilities2.getFontMetrics(menuItem, g);
    final int index = menuItem.getDisplayedMnemonicIndex();
    final SynthContext context = originalUI.getContext(menuItem);
    final Color fg = context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND);
    final Color shadow = UIUtil.shade(menuItem.getBackground(), 1.24, 0.5);
    g.setColor(shadow);
    SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, index, textRect.x + 1, textRect.y + fm.getAscent() + 1);
    g.setColor(fg);
    SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, index, textRect.x, textRect.y + fm.getAscent());
}
Also used : SynthContext(javax.swing.plaf.synth.SynthContext)

Example 4 with SynthContext

use of javax.swing.plaf.synth.SynthContext in project intellij-community by JetBrains.

the class GtkMenuItemUI method update.

@Override
public void update(final Graphics g, final JComponent c) {
    myHiddenItem.setSelected(menuItem.isSelected());
    if (UIUtil.isMurrineBasedTheme()) {
        acceleratorFont = menuItem.getFont();
        SynthContext context = myOriginalUI.getContext(menuItem);
        Color fg = context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND);
        acceleratorForeground = UIUtil.mix(fg, menuItem.getBackground(), menuItem.isSelected() ? 0.4 : 0.2);
        disabledForeground = fg;
    }
    if (checkIcon != null && !(checkIcon instanceof IconWrapper) && !(checkIcon instanceof EmptyIcon)) {
        checkIcon = new IconWrapper(checkIcon, myOriginalUI);
    }
    super.update(g, c);
}
Also used : SynthContext(javax.swing.plaf.synth.SynthContext) EmptyIcon(com.intellij.util.ui.EmptyIcon)

Example 5 with SynthContext

use of javax.swing.plaf.synth.SynthContext in project intellij-community by JetBrains.

the class IconWrapper method paintIcon.

@Override
public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
    SynthContext context = myOriginalUI.getContext((JComponent) c);
    ((SynthIcon) myIcon).paintIcon(context, g, x, y, getIconWidth(), getIconHeight());
}
Also used : SynthContext(javax.swing.plaf.synth.SynthContext) SynthIcon(sun.swing.plaf.synth.SynthIcon)

Aggregations

SynthContext (javax.swing.plaf.synth.SynthContext)5 EmptyIcon (com.intellij.util.ui.EmptyIcon)1 BufferedImage (java.awt.image.BufferedImage)1 SynthLookAndFeel (javax.swing.plaf.synth.SynthLookAndFeel)1 SynthSliderUI (javax.swing.plaf.synth.SynthSliderUI)1 SynthIcon (sun.swing.plaf.synth.SynthIcon)1