IDEA-149337 [follow-up] UI fonts are too big

Use Class.forName/newInstance for instantiating platform-dependent LaF.
This commit is contained in:
Anton Tarasov
2016-03-25 18:07:40 +03:00
parent dfdf234ea3
commit 8f27328100
@@ -2558,9 +2558,15 @@ public class UIUtil {
// Here we weaken the requirements to only 2) and force GTK LaF
// installation in order to let it properly scale default font
// based on Xft.dpi value.
LookAndFeel laf = new GTKLookAndFeel();
if (laf.isSupportedLookAndFeel()) { // if gtk lib is available
return systemLaFClassName = laf.getClass().getName();
try {
String name = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
Class cls = Class.forName(name);
LookAndFeel laf = (LookAndFeel)cls.newInstance();
if (laf.isSupportedLookAndFeel()) { // if gtk lib is available
return systemLaFClassName = name;
}
}
catch (Exception ignore) {
}
}
return systemLaFClassName = UIManager.getSystemLookAndFeelClassName();