src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java

Print this page




  89     /**
  90      * Loads the GTK libraries, if necessary.  The first time this method
  91      * is called, it will attempt to load the native GTK library.  If
  92      * successful, it leaves the library open and returns true; otherwise,
  93      * the library is left closed and returns false.  On future calls to
  94      * this method, the status of the first attempt is returned (a simple
  95      * lightweight boolean check, no native calls required).
  96      */
  97     public boolean loadGTK() {
  98         synchronized (GTK_LOCK) {
  99             if (nativeGTKLoaded == null) {
 100                 nativeGTKLoaded = load_gtk();
 101             }
 102         }
 103         return nativeGTKLoaded;
 104     }
 105 
 106     /**
 107      * Overridden to handle GTK icon loading
 108      */

 109     protected Object lazilyLoadDesktopProperty(String name) {
 110         if (name.startsWith("gtk.icon.")) {
 111             return lazilyLoadGTKIcon(name);
 112         }
 113         return super.lazilyLoadDesktopProperty(name);
 114     }
 115 
 116     /**
 117      * Load a native Gtk stock icon.
 118      *
 119      * @param longname a desktop property name. This contains icon name, size
 120      *        and orientation, e.g. <code>"gtk.icon.gtk-add.4.rtl"</code>
 121      * @return an <code>Image</code> for the icon, or <code>null</code> if the
 122      *         icon could not be loaded
 123      */
 124     protected Object lazilyLoadGTKIcon(String longname) {
 125         // Check if we have already loaded it.
 126         Object result = desktopProperties.get(longname);
 127         if (result != null) {
 128             return result;




  89     /**
  90      * Loads the GTK libraries, if necessary.  The first time this method
  91      * is called, it will attempt to load the native GTK library.  If
  92      * successful, it leaves the library open and returns true; otherwise,
  93      * the library is left closed and returns false.  On future calls to
  94      * this method, the status of the first attempt is returned (a simple
  95      * lightweight boolean check, no native calls required).
  96      */
  97     public boolean loadGTK() {
  98         synchronized (GTK_LOCK) {
  99             if (nativeGTKLoaded == null) {
 100                 nativeGTKLoaded = load_gtk();
 101             }
 102         }
 103         return nativeGTKLoaded;
 104     }
 105 
 106     /**
 107      * Overridden to handle GTK icon loading
 108      */
 109     @Override
 110     protected Object lazilyLoadDesktopProperty(String name) {
 111         if (name.startsWith("gtk.icon.")) {
 112             return lazilyLoadGTKIcon(name);
 113         }
 114         return super.lazilyLoadDesktopProperty(name);
 115     }
 116 
 117     /**
 118      * Load a native Gtk stock icon.
 119      *
 120      * @param longname a desktop property name. This contains icon name, size
 121      *        and orientation, e.g. <code>"gtk.icon.gtk-add.4.rtl"</code>
 122      * @return an <code>Image</code> for the icon, or <code>null</code> if the
 123      *         icon could not be loaded
 124      */
 125     protected Object lazilyLoadGTKIcon(String longname) {
 126         // Check if we have already loaded it.
 127         Object result = desktopProperties.get(longname);
 128         if (result != null) {
 129             return result;