--- old/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java 2018-09-12 13:10:42.423423227 +0530 +++ new/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java 2018-09-12 13:10:42.187423227 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,8 @@ * @author Scott Violet */ public class GTKLookAndFeel extends SynthLookAndFeel { - private static final boolean IS_22; + private static boolean IS_22; + private static boolean IS_3; /** * Whether or not text is drawn antialiased. This keys off the @@ -105,16 +106,6 @@ private static String gtkThemeName = "Default"; static { - // Backup for specifying the version, this isn't currently documented. - // If you pass in anything but 2.2 you got the 2.0 colors/look. - String version = AccessController.doPrivileged( - new GetPropertyAction("swing.gtk.version")); - if (version != null) { - IS_22 = version.equals("2.2"); - } - else { - IS_22 = true; - } String language = Locale.getDefault().getLanguage(); boolean cjkLocale = @@ -156,6 +147,10 @@ return IS_22; } + static boolean is3() { + return IS_3; + } + /** * Maps a swing constant to a GTK constant. */ @@ -545,7 +540,7 @@ public Object createValue(UIDefaults table) { GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory(); GTKStyle style = (GTKStyle)factory.getStyle(null, region); - return style.getFontForState(null); + return style.getDefaultFont(); } } @@ -1457,6 +1452,19 @@ throw new InternalError("Unable to load native GTK libraries"); } + if (UNIXToolkit.getGtkVersion() == UNIXToolkit.GtkVersions.GTK2) { + String version = AccessController.doPrivileged( + new GetPropertyAction("jdk.gtk.version")); + if (version != null) { + IS_22 = version.equals("2.2"); + } else { + IS_22 = true; + } + } else if (UNIXToolkit.getGtkVersion() == + UNIXToolkit.GtkVersions.GTK3) { + IS_3 = true; + } + super.initialize(); inInitialize = true; loadStyles();