use of javax.swing.plaf.synth.SynthStyle in project intellij-community by JetBrains.
the class LafManagerImpl method patchGtkDefaults.
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));
}
}
use of javax.swing.plaf.synth.SynthStyle in project intellij-community by JetBrains.
the class LafManagerImpl method fixGtkPopupStyle.
private static void fixGtkPopupStyle() {
if (!UIUtil.isUnderGTKLookAndFeel())
return;
final SynthStyleFactory original = SynthLookAndFeel.getStyleFactory();
SynthLookAndFeel.setStyleFactory(new SynthStyleFactory() {
@Override
public SynthStyle getStyle(final JComponent c, final Region id) {
final SynthStyle style = original.getStyle(c, id);
if (id == Region.POPUP_MENU) {
final Integer x = ReflectionUtil.getField(style.getClass(), style, int.class, "xThickness");
if (x != null && x == 0) {
// workaround for Sun bug #6636964
ReflectionUtil.setField(style.getClass(), style, int.class, "xThickness", 1);
ReflectionUtil.setField(style.getClass(), style, int.class, "yThickness", 3);
}
}
return style;
}
});
// invokes updateUI() -> updateStyle()
new JBPopupMenu();
SynthLookAndFeel.setStyleFactory(original);
}
use of javax.swing.plaf.synth.SynthStyle in project jdk8u_jdk by JetBrains.
the class NimbusLookAndFeel method initialize.
/** Called by UIManager when this look and feel is installed. */
@Override
public void initialize() {
super.initialize();
defaults.initialize();
// create synth style factory
setStyleFactory(new SynthStyleFactory() {
@Override
public SynthStyle getStyle(JComponent c, Region r) {
return defaults.getStyle(c, r);
}
});
}
Aggregations