< prev index next >
src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2002, 2015, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 50,60 ****
/**
* @author Scott Violet
*/
public class GTKLookAndFeel extends SynthLookAndFeel {
! private static final boolean IS_22;
/**
* Whether or not text is drawn antialiased. This keys off the
* desktop property 'gnome.Xft/Antialias' and 'gnome.Xft/RGBA'
* We should assume ON - or some variation of ON as no GTK desktop
--- 50,61 ----
/**
* @author Scott Violet
*/
public class GTKLookAndFeel extends SynthLookAndFeel {
! private static boolean IS_22;
! private static boolean IS_3;
/**
* Whether or not text is drawn antialiased. This keys off the
* desktop property 'gnome.Xft/Antialias' and 'gnome.Xft/RGBA'
* We should assume ON - or some variation of ON as no GTK desktop
*** 103,122 ****
* Cached theme name. Used by GTKGraphicsUtils
*/
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 =
(Locale.CHINESE.getLanguage().equals(language) ||
Locale.JAPANESE.getLanguage().equals(language) ||
--- 104,113 ----
*** 154,163 ****
--- 145,158 ----
// need to get the major/minor/micro version from the .so.
// Refer to bug 4912613 for details.
return IS_22;
}
+ static boolean is3() {
+ return IS_3;
+ }
+
/**
* Maps a swing constant to a GTK constant.
*/
static PositionType SwingOrientationConstantToGTK(int side) {
switch (side) {
*** 543,553 ****
this.region = region;
}
public Object createValue(UIDefaults table) {
GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory();
GTKStyle style = (GTKStyle)factory.getStyle(null, region);
! return style.getFontForState(null);
}
}
Object[] defaults = new Object[] {
"ArrowButton.size", Integer.valueOf(13),
--- 538,548 ----
this.region = region;
}
public Object createValue(UIDefaults table) {
GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory();
GTKStyle style = (GTKStyle)factory.getStyle(null, region);
! return style.getDefaultFont();
}
}
Object[] defaults = new Object[] {
"ArrowButton.size", Integer.valueOf(13),
*** 1455,1464 ****
--- 1450,1472 ----
!((UNIXToolkit)toolkit).loadGTK())
{
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();
inInitialize = false;
< prev index next >