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; 130 } 131 132 // We need to have at least gtk.icon.<stock_id>.<size>.<orientation> 133 String str[] = longname.split("\\."); 134 if (str.length != 5) { 135 return null; 136 } 137 138 // Parse out the stock icon size we are looking for. 139 int size = 0; 140 try { 141 size = Integer.parseInt(str[3]); 142 } catch (NumberFormatException nfe) { | 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"} 122 * @return an {@code Image} for the icon, or {@code null} 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; 130 } 131 132 // We need to have at least gtk.icon.<stock_id>.<size>.<orientation> 133 String str[] = longname.split("\\."); 134 if (str.length != 5) { 135 return null; 136 } 137 138 // Parse out the stock icon size we are looking for. 139 int size = 0; 140 try { 141 size = Integer.parseInt(str[3]); 142 } catch (NumberFormatException nfe) { |