Java Code Examples for sun.awt.UNIXToolkit#getGtkVersion()

The following examples show how to use sun.awt.UNIXToolkit#getGtkVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GTKLookAndFeel.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public void initialize() {
    /*
     * We need to call loadGTK() to ensure that the native GTK
     * libraries are loaded.  It is very unlikely that this call will
     * fail (since we've already verified native GTK support in
     * isSupportedLookAndFeel()), but we can throw an error in the
     * failure situation just in case.
     */
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof UNIXToolkit &&
        !((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;

    /*
     * Check if system AA font settings should be used.
     * Sun's JDS (for Linux and Solaris) ships with high quality CJK
     * fonts and specifies via fontconfig that these be rendered in
     * B&W to take advantage of the embedded bitmaps.
     * If is a Sun CJK locale or remote display, indicate by the condition
     * variable that in this case the L&F recommends ignoring desktop
     * settings. On other Unixes (eg Linux) this doesn't apply.
     * REMIND 1: The isSunCJK test is really just a place holder
     * until we can properly query fontconfig and use the properties
     * set for specific fonts.
     * REMIND 2: See comment on isLocalDisplay() definition regarding
     * XRender.
     */
    gtkAAFontSettingsCond = !isSunCJK && SwingUtilities2.isLocalDisplay();
    aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(gtkAAFontSettingsCond);
}
 
Example 2
Source File: GTKLookAndFeel.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void initialize() {
    /*
     * We need to call loadGTK() to ensure that the native GTK
     * libraries are loaded.  It is very unlikely that this call will
     * fail (since we've already verified native GTK support in
     * isSupportedLookAndFeel()), but we can throw an error in the
     * failure situation just in case.
     */
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof UNIXToolkit &&
        !((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;

    /*
     * Check if system AA font settings should be used.
     * Sun's JDS (for Linux and Solaris) ships with high quality CJK
     * fonts and specifies via fontconfig that these be rendered in
     * B&W to take advantage of the embedded bitmaps.
     * If is a Sun CJK locale or remote display, indicate by the condition
     * variable that in this case the L&F recommends ignoring desktop
     * settings. On other Unixes (eg Linux) this doesn't apply.
     * REMIND 1: The isSunCJK test is really just a place holder
     * until we can properly query fontconfig and use the properties
     * set for specific fonts.
     * REMIND 2: See comment on isLocalDisplay() definition regarding
     * XRender.
     */
    gtkAAFontSettingsCond = !isSunCJK && SwingUtilities2.isLocalDisplay();
    aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(gtkAAFontSettingsCond);
}
 
Example 3
Source File: GTKLookAndFeel.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void initialize() {
    /*
     * We need to call loadGTK() to ensure that the native GTK
     * libraries are loaded.  It is very unlikely that this call will
     * fail (since we've already verified native GTK support in
     * isSupportedLookAndFeel()), but we can throw an error in the
     * failure situation just in case.
     */
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof UNIXToolkit &&
        !((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;

    /*
     * Check if system AA font settings should be used.
     * Sun's JDS (for Linux and Solaris) ships with high quality CJK
     * fonts and specifies via fontconfig that these be rendered in
     * B&W to take advantage of the embedded bitmaps.
     * If is a Sun CJK locale or remote display, indicate by the condition
     * variable that in this case the L&F recommends ignoring desktop
     * settings. On other Unixes (eg Linux) this doesn't apply.
     * REMIND 1: The isSunCJK test is really just a place holder
     * until we can properly query fontconfig and use the properties
     * set for specific fonts.
     * REMIND 2: See comment on isLocalDisplay() definition regarding
     * XRender.
     */
    gtkAAFontSettingsCond = !isSunCJK && SwingUtilities2.isLocalDisplay();
    aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(gtkAAFontSettingsCond);
}
 
Example 4
Source File: GTKLookAndFeel.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public void initialize() {
    /*
     * We need to call loadGTK() to ensure that the native GTK
     * libraries are loaded.  It is very unlikely that this call will
     * fail (since we've already verified native GTK support in
     * isSupportedLookAndFeel()), but we can throw an error in the
     * failure situation just in case.
     */
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof UNIXToolkit &&
        !((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;

    /*
     * Check if system AA font settings should be used.
     * REMIND: See comment on isLocalDisplay() definition regarding
     * XRender.
     */
    gtkAAFontSettingsCond = SwingUtilities2.isLocalDisplay();
    aaTextInfo = new HashMap<>(2);
    SwingUtilities2.putAATextInfo(gtkAAFontSettingsCond, aaTextInfo);
}
 
Example 5
Source File: GTKLookAndFeel.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void initialize() {
    /*
     * We need to call loadGTK() to ensure that the native GTK
     * libraries are loaded.  It is very unlikely that this call will
     * fail (since we've already verified native GTK support in
     * isSupportedLookAndFeel()), but we can throw an error in the
     * failure situation just in case.
     */
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof UNIXToolkit &&
        !((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;

    /*
     * Check if system AA font settings should be used.
     * REMIND: See comment on isLocalDisplay() definition regarding
     * XRender.
     */
    gtkAAFontSettingsCond = SwingUtilities2.isLocalDisplay();
    aaTextInfo = new HashMap<>(2);
    SwingUtilities2.putAATextInfo(gtkAAFontSettingsCond, aaTextInfo);
}
 
Example 6
Source File: GTKLookAndFeel.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public void initialize() {
    /*
     * We need to call loadGTK() to ensure that the native GTK
     * libraries are loaded.  It is very unlikely that this call will
     * fail (since we've already verified native GTK support in
     * isSupportedLookAndFeel()), but we can throw an error in the
     * failure situation just in case.
     */
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    if (toolkit instanceof UNIXToolkit &&
        !((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;

    /*
     * Check if system AA font settings should be used.
     * Sun's JDS (for Linux and Solaris) ships with high quality CJK
     * fonts and specifies via fontconfig that these be rendered in
     * B&W to take advantage of the embedded bitmaps.
     * If is a Sun CJK locale or remote display, indicate by the condition
     * variable that in this case the L&F recommends ignoring desktop
     * settings. On other Unixes (eg Linux) this doesn't apply.
     * REMIND 1: The isSunCJK test is really just a place holder
     * until we can properly query fontconfig and use the properties
     * set for specific fonts.
     * REMIND 2: See comment on isLocalDisplay() definition regarding
     * XRender.
     */
    gtkAAFontSettingsCond = !isSunCJK && SwingUtilities2.isLocalDisplay();
    aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(gtkAAFontSettingsCond);
}