diff options
Diffstat (limited to 'debian/patches/java9-lookandfeel.patch')
-rw-r--r-- | debian/patches/java9-lookandfeel.patch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/debian/patches/java9-lookandfeel.patch b/debian/patches/java9-lookandfeel.patch new file mode 100644 index 00000000..3690ae71 --- /dev/null +++ b/debian/patches/java9-lookandfeel.patch @@ -0,0 +1,76 @@ +commit d08c584374a98f094064ee90e4d67fa0db1d18a7 +Author: Erich Schubert <schubert@informatik.uni-heidelberg.de> +Date: Thu May 10 17:06:57 2018 +0200 + + Avoid non-public API call (disallowed in Java9+) just for lookandfeel. + +--- a/elki/src/main/java/de/lmu/ifi/dbs/elki/gui/GUIUtil.java ++++ b/elki/src/main/java/de/lmu/ifi/dbs/elki/gui/GUIUtil.java +@@ -23,11 +23,8 @@ + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +-import java.awt.Toolkit; +-import java.lang.reflect.Method; +- +-import javax.swing.RepaintManager; + import javax.swing.UIManager; ++import javax.swing.UIManager.LookAndFeelInfo; + + import de.lmu.ifi.dbs.elki.logging.Logging; + +@@ -39,11 +36,6 @@ + */ + public final class GUIUtil { + /** +- * Enable thread repaint debugging. +- */ +- public static final boolean THREAD_REPAINT_DEBUG = false; +- +- /** + * Whether to prefer the GTK look and feel on Unix. + */ + public static final boolean PREFER_GTK = true; +@@ -59,33 +51,17 @@ + * Setup look at feel. + */ + public static void setLookAndFeel() { +- // If enabled, setup thread debugging. +- if(THREAD_REPAINT_DEBUG) { +- try { +- Class<?> cls = ClassLoader.getSystemClassLoader().loadClass("org.jdesktop.swinghelper.debug.CheckThreadViolationRepaintManager"); +- RepaintManager.setCurrentManager((RepaintManager) cls.newInstance()); +- } +- catch(Exception e) { +- // ignore +- } +- } +- if(PREFER_GTK) { +- try { +- Toolkit toolkit = Toolkit.getDefaultToolkit(); +- // Note: we don't want to *require* these classes +- // But if they exist, we're going to try using them. +- Class<?> suntoolkit = Class.forName("sun.awt.SunToolkit"); +- Method testm = suntoolkit.getMethod("isNativeGTKAvailable"); +- if(suntoolkit.isInstance(toolkit) && (Boolean) testm.invoke(toolkit)) { +- UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); +- return; ++ try { ++ if(PREFER_GTK) { ++ LookAndFeelInfo[] lfs = UIManager.getInstalledLookAndFeels(); ++ for(LookAndFeelInfo lf : lfs) { ++ if(lf.getClassName().contains("GTK")) { ++ UIManager.setLookAndFeel(lf.getClassName()); ++ return; ++ } + } + } +- catch(Exception e) { +- // ignore +- } +- } +- try { ++ // Fallback: + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } + catch(Exception e) { |