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());
}
});
}
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;
}
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());
}
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);
}
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());
}
Aggregations