From 8f27328100dc963ed2b6c7584e5c813d0576dcc3 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Fri, 25 Mar 2016 18:06:12 +0300 Subject: [PATCH] IDEA-149337 [follow-up] UI fonts are too big Use Class.forName/newInstance for instantiating platform-dependent LaF. --- platform/util/src/com/intellij/util/ui/UIUtil.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index f4437ce0d81b..69935bc5ef7a 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -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();