## org.gnu.glib
Class GObject

    java.lang.Object
      org.gnu.glib.GObject

Direct Known Subclasses:
  AccelGroup, Action, ActionGroup, AtkObject, AttrList, CellEditable, CellRenderer, Colormap, Context, CustomEvents, Device, Display, DragContext, Drawable, EntryCompletion, FileFilter, Font, FontFace, FontFamily, GC, Geometry, GListString, GtkObject, Hyperlink, IconFactory, IconTheme, Image, IMContext, Keymap, Layout, ObjectFactory, Pixbuf, PixbufLoader, RcStyle, Registry, Relation, RelationSet, Screen, SelectionData, Settings, SizeGroup, StateSet, Style, TextBuffer, TextChildAnchor, TextMark, TextTag, TextTagTable, TreeModel, TreeSelection, TreeViewColumn, TypeInterface, UIManager, Visual, WindowAttr, WindowGroup

public class GObject
extends java.lang.Object

Base class for all objects that participate in the GLib object system.

Field Summary
`protected boolean` `eventsInitialized` Event initialization marker.

Constructor Summary
`protected` `GObject()` Create an uninitialized instance.
`` `GObject(Handle handle)` Create a new GObject with a handle to a native resource returned from a call to the native libraries.
`` `GObject(Type type)` Create a new GObject of the given type.

Method Summary
`int` `addEventHandler(java.lang.String name, java.lang.Object cbrecv)` Connect an event to a callback method that has the same name as the event.
`int` `addEventHandler(java.lang.String name, java.lang.Object cbrecv, java.lang.Object data)` Connect a event to a callback method that has the same name as the event.
`int` `addEventHandler(java.lang.String name, java.lang.String func, java.lang.Class cbrecv)` Connect a event to a static callback method "func" in Class "cbrecv".
`int` `addEventHandler(java.lang.String name, java.lang.String func, java.lang.Class cbrecv, java.lang.Object data)` Connect a event to a static callback method "func" in Class "cbrecv".
`int` `addEventHandler(java.lang.String name, java.lang.String func, java.lang.Object cbrecv)` Connect a event to a callback method "func" in object "cbrecv".
`int` `addEventHandler(java.lang.String name, java.lang.String func, java.lang.Object cbrecv, java.lang.Object data)` Connect a event to a callback method "func" in object "cbrecv".
`void` `addListener(PropertyNotificationListener listen)` Add a listener that will be activated when a property is updated updated ("notify" signal).
`boolean` `equals(java.lang.Object other)` Check if two objects refer to the same (native) object.
`void` `freezeNotify()` Stops emission of "notify" signals on object.
`boolean` `getBooleanProperty(java.lang.String name)` Convenience method for retrieving `boolean` properties.
`protected static java.lang.Object` `getData(Handle handle, java.lang.String key)`
`java.lang.Object` `getData(java.lang.String key)` Gets the Java `Object` associated with the given key from this object's object association table.
`double` `getDoubleProperty(java.lang.String name)` Convenience method for retrieving `double` properties.
`java.lang.Class` `getEventListenerClass(java.lang.String signal)`
`EventType` `getEventType(java.lang.String signal)`
`float` `getFloatProperty(java.lang.String name)` Convenience method for retrieving `float` properties.
`static GObject` `getGObjectFromHandle(Handle hndl)` Gets a `GObject` instance for the given `Handle`.
`Handle` `getHandle()` Get the raw handle value.
`protected static int` `getIntFromHandle(Handle handle)` Return the int to which the native `Handle` holds a pointer.
`int` `getIntProperty(java.lang.String name)` Convenience method for retrieving `int` properties.
`java.lang.Object` `getJavaObjectProperty(java.lang.String name)` Convenience method for retrieving `Object` properties.
`long` `getLongProperty(java.lang.String name)` Convenience method for retrieving `long` properties.
`static Handle` `getNullHandle()` Get a native handle that refers to a null pointer.
`Pixbuf` `getPixbufProperty(java.lang.String name)` Convenience method for retrieving `Pixbuf` properties.
`Value` `getProperty(java.lang.String name)` Get the `Value` of the given property (`name`).
`protected static java.lang.String` `getStringFromHandle(Handle handle)` Return the String to which the native `Handle` holds a pointer.
`java.lang.String` `getStringProperty(java.lang.String name)` Convenience method for retrieving `String` properties.
`int` `hashCode()` Returns a hash code value for the object.
`boolean` `hasProperty(java.lang.String name)` Determines if this object supports the given named property.
`protected static java.lang.Object` `instantiateJGObjectFromGType(int type, Handle handle)`
`void` `notify(java.lang.String property_name)` Emits a "notify" signal for the given property.
`void` `removeEventHandler(int handler)` Disconnect a event from its' callback method.
`void` `removeListener(PropertyNotificationListener listen)` Remove the given listener from those activated when a property is updated.
`protected GObject` `retrieveGObject(Handle hndl)` Deprecated. This method is deprecated in favor of `getGObjectFromHandle(org.gnu.glib.Handle)`.
`void` `setBooleanProperty(java.lang.String name, boolean value)` Convenience method for setting `boolean` properties.
`protected static void` `setData(Handle handle, java.lang.String key, java.lang.Object data)`
`void` `setData(java.lang.String key, java.lang.Object data)` Sets an association from a String to a Java `Object` to be stored in the GTK object's table of associations.
`void` `setDoubleProperty(java.lang.String name, double value)` Convenience method for setting `double` properties.
`void` `setFloatProperty(java.lang.String name, float value)` Convenience method for setting `float` properties.
`protected void` `setHandle(Handle hndl)` Sets this object's native handle.
`void` `setIntProperty(java.lang.String name, int value)` Convenience method for setting `int` properties.
`void` `setJavaObjectProperty(java.lang.String name, java.lang.Object value)` Convenience method for setting `Object` properties.
`void` `setLongProperty(java.lang.String name, long value)` Convenience method for setting `long` properties.
`void` `setPixbufProperty(java.lang.String name, Pixbuf value)` Convenience method for setting `Pixbuf` properties.
`void` `setProperty(java.lang.String name, Value val)` Set the given property (`name`) with the given `Value` on this object.
`void` `setStringProperty(java.lang.String name, java.lang.String value)` Convenience method for setting `String` properties.
`void` `thawNotify()` Reverts the effect of a previous call to `freezeNotify()`.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### eventsInitialized

    protected boolean eventsInitialized

  Event initialization marker.

Constructor Detail

### GObject

    protected GObject()

  Create an uninitialized instance. This has potential uses for derived classes.

### GObject

    public GObject(Type type)

  Create a new GObject of the given type.

### GObject

    public GObject(Handle handle)

  Create a new GObject with a handle to a native resource returned from a call to the native libraries.

Parameters:
  `handle` - The handle that represents a pointer to a native resource.

Method Detail

### getHandle

    public final Handle getHandle()

  Get the raw handle value. This value should never be modified by the application. It's sole use is to pass to native methods.

  Returns:
    the handle value.

### equals

    public boolean equals(java.lang.Object other)

  Check if two objects refer to the same (native) object.

  Parameters:
    `other` - the reference object with which to compare.
  Returns:
    true if both objects refer to the same object.

### hashCode

    public int hashCode()

  Returns a hash code value for the object. This allows for using GObjects as keys in hashmaps.

  Returns:
    a hash code value for the object.

### addEventHandler

    public int addEventHandler(java.lang.String name,
                               java.lang.Object cbrecv)

  Connect an event to a callback method that has the same name as the event. For example, the event "clicked" will be mapped to a method "clicked()" in the object cbrecv.

  Parameters:
    `name` - The name of the event to map.
    `cbrecv` - The name of the object that is to recieve the event.
  Returns:
    The handle id of the event that can be used in a call to removeEventHandler.

### addEventHandler

    public int addEventHandler(java.lang.String name,
                               java.lang.Object cbrecv,
                               java.lang.Object data)

  Connect a event to a callback method that has the same name as the event. For example, the event "clicked" will be mapped to a method "clicked()" in the object cbrecv.

  Parameters:
    `name` - The name of the event to map.
    `cbrecv` - The name of the object that is to recieve the event.
    `data` - User defined data that will be passed to the callback.
  Returns:
    The handle id of the event that can be used in a call to removeEventHandler.

### addEventHandler

    public int addEventHandler(java.lang.String name,
                               java.lang.String func,
                               java.lang.Object cbrecv)

  Connect a event to a callback method "func" in object "cbrecv".

  Parameters:
    `name` - The name of the event to map.
    `func` - The name of the callback method.
    `cbrecv` - The name of the object that is to recieve the event.
  Returns:
    The handle id of the event that can be used in a call to removeEventHandler.

### addEventHandler

    public int addEventHandler(java.lang.String name,
                               java.lang.String func,
                               java.lang.Object cbrecv,
                               java.lang.Object data)

  Connect a event to a callback method "func" in object "cbrecv".

  Parameters:
    `name` - The name of the event to map.
    `func` - The name of the callback method.
    `cbrecv` - The name of the object that is to recieve the event.
    `data` - User defined data that will be passed to the callback.
  Returns:
    The handle id of the event that can be used in a call to removeEventHandler.

### addEventHandler

    public int addEventHandler(java.lang.String name,
                               java.lang.String func,
                               java.lang.Class cbrecv)

  Connect a event to a static callback method "func" in Class "cbrecv".

  Parameters:
    `name` - The name of the event to map.
    `func` - The name of the static callback method.
    `cbrecv` - The name of the class that is to recieve the event.
  Returns:
    The handle id of the event that can be used in a call to removeEventHandler.

### addEventHandler

    public int addEventHandler(java.lang.String name,
                               java.lang.String func,
                               java.lang.Class cbrecv,
                               java.lang.Object data)

  Connect a event to a static callback method "func" in Class "cbrecv".

  Parameters:
    `name` - The name of the event to map.
    `func` - The name of the static callback method.
    `cbrecv` - The name of the class that is to recieve the event.
    `data` - User defined data that will be passed to the callback.
  Returns:
    The handle id of the event that can be used in a call to removeEventHandler.

### removeEventHandler

    public void removeEventHandler(int handler)

  Disconnect a event from its' callback method.

  Parameters:
    `handler` - The handler id of the event. This is the value returned from a call to addEventHandler().

### getData

    public java.lang.Object getData(java.lang.String key)

  Gets the Java `Object` associated with the given key from this object's object association table.

  Parameters:
    `key` - The association key.
  Returns:
    The Java `Object` associated with this key or `null` if the named association key does not exist.
  See Also:
    `setData(String,Object)`

### setData

    public void setData(java.lang.String key,
                        java.lang.Object data)

  Sets an association from a String to a Java `Object` to be stored in the GTK object's table of associations. If the object already had an association with the given key, the old association will be destroyed.

  Parameters:
    `key` - The association key.
    `data` - The Java `Object` to associate with the given key.
  See Also:
    `getData(String)`

### getEventListenerClass

    public java.lang.Class getEventListenerClass(java.lang.String signal)

### getEventType

    public EventType getEventType(java.lang.String signal)

### setProperty

    public void setProperty(java.lang.String name,
                            Value val)

  Set the given property (`name`) with the given `Value` on this object. If there is a GTK property with this name, the GTK property will be set. Otherwise, a Java-side property will be set.

  NOTE: Prefer using one of the convenience methods over using this method directly.

  Parameters:
    `name` - The name of the property to set.
    `val` - The value to set in the property.

### setIntProperty

    public void setIntProperty(java.lang.String name,
                               int value)

  Convenience method for setting `int` properties.

  Parameters:
    `name` - The name of the property to set.
    `value` - The value to set in the property.
  See Also:
    `setProperty( String, Value )`

### setStringProperty

    public void setStringProperty(java.lang.String name,
                                  java.lang.String value)

  Convenience method for setting `String` properties.

  Parameters:
    `name` - The name of the property to set.
    `value` - The value to set in the property.
  See Also:
    `setProperty( String, Value )`

### setBooleanProperty

    public void setBooleanProperty(java.lang.String name,
                                   boolean value)

  Convenience method for setting `boolean` properties.

  Parameters:
    `name` - The name of the property to set.
    `value` - The value to set in the property.
  See Also:
    `setProperty( String, Value )`

### setFloatProperty

    public void setFloatProperty(java.lang.String name,
                                 float value)

  Convenience method for setting `float` properties.

  Parameters:
    `name` - The name of the property to set.
    `value` - The value to set in the property.
  See Also:
    `setProperty( String, Value )`

### setLongProperty

    public void setLongProperty(java.lang.String name,
                                long value)

  Convenience method for setting `long` properties.

  Parameters:
    `name` - The name of the property to set.
    `value` - The value to set in the property.
  See Also:
    `setProperty( String, Value )`

### setDoubleProperty

    public void setDoubleProperty(java.lang.String name,
                                  double value)

  Convenience method for setting `double` properties.

  Parameters:
    `name` - The name of the property to set.
    `value` - The value to set in the property.
  See Also:
    `setProperty( String, Value )`

### setPixbufProperty

    public void setPixbufProperty(java.lang.String name,
                                  Pixbuf value)

  Convenience method for setting `Pixbuf` properties.

  Parameters:
    `name` - The name of the property to set.
    `value` - The value to set in the property.
  See Also:
    `setProperty( String, Value )`

### setJavaObjectProperty

    public void setJavaObjectProperty(java.lang.String name,
                                      java.lang.Object value)

  Convenience method for setting `Object` properties.

  Parameters:
    `name` - The name of the property to set.
    `value` - The value to set in the property.

### getProperty

    public Value getProperty(java.lang.String name)

  Get the `Value` of the given property (`name`). If there is a GTK property with this name, the GTK property will be retrived. Otherwise, a Java-side property will be returned.

  NOTE: Prefer using one of the convenience methods over using this method directly.

  Parameters:
    `name` - The name of the property to retrieve.
  Returns:
    The value of the given property.

### getIntProperty

    public int getIntProperty(java.lang.String name)

  Convenience method for retrieving `int` properties.

  Parameters:
    `name` - The name of the property to retrieve.
  Returns:
    The value of the given property.

### getStringProperty

    public java.lang.String getStringProperty(java.lang.String name)

  Convenience method for retrieving `String` properties.

  Parameters:
    `name` - The name of the property to retrieve.
  Returns:
    The value of the given property.

### getBooleanProperty

    public boolean getBooleanProperty(java.lang.String name)

  Convenience method for retrieving `boolean` properties.

  Parameters:
    `name` - The name of the property to retrieve.
  Returns:
    The value of the given property.

### getFloatProperty

    public float getFloatProperty(java.lang.String name)

  Convenience method for retrieving `float` properties.

  Parameters:
    `name` - The name of the property to retrieve.
  Returns:
    The value of the given property.

### getLongProperty

    public long getLongProperty(java.lang.String name)

  Convenience method for retrieving `long` properties.

  Parameters:
    `name` - The name of the property to retrieve.
  Returns:
    The value of the given property.

### getDoubleProperty

    public double getDoubleProperty(java.lang.String name)

  Convenience method for retrieving `double` properties.

  Parameters:
    `name` - The name of the property to retrieve.
  Returns:
    The value of the given property.

### getPixbufProperty

    public Pixbuf getPixbufProperty(java.lang.String name)

  Convenience method for retrieving `Pixbuf` properties.

  Parameters:
    `name` - The name of the property to retrieve.
  Returns:
    The value of the given property.

### getJavaObjectProperty

    public java.lang.Object getJavaObjectProperty(java.lang.String name)

  Convenience method for retrieving `Object` properties.

  Parameters:
    `name` - The name of the property to retrieve.
  Returns:
    The value of the given property.

### hasProperty

    public boolean hasProperty(java.lang.String name)

  Determines if this object supports the given named property. First the GTK properties are checked, then, if no property with this name is found, the Java-side properties are checked.

  Parameters:
    `name` - The property to verify.
  Returns:
    True if the given name is a property of this object, false otherwise.

### addListener

    public void addListener(PropertyNotificationListener listen)

  Add a listener that will be activated when a property is updated updated ("notify" signal). The notify signal is emitted on an object when one of its properties has been changed. Note that getting this signal doesn't guarantee that the value of the property has actually changed, it may also be emitted when the setter for the property is called to reinstate the previous value.

### removeListener

    public void removeListener(PropertyNotificationListener listen)

  Remove the given listener from those activated when a property is updated.

### freezeNotify

    public void freezeNotify()

  Stops emission of "notify" signals on object. The signals are queued until `thawNotify()` is called.

  This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

### notify

    public void notify(java.lang.String property_name)

  Emits a "notify" signal for the given property. The property can be a GTK native property or a Java-side property. If no property exist by the given name, this method does nothing.

  Parameters:
    `property_name` - The name of a property installed on the class of this object.

### thawNotify

    public void thawNotify()

  Reverts the effect of a previous call to `freezeNotify()`. This causes all queued "notify" signals on object to be emitted.

### setHandle

    protected void setHandle(Handle hndl)

  Sets this object's native handle.

### retrieveGObject

    protected GObject retrieveGObject(Handle hndl)

  Deprecated. This method is deprecated in favor of `getGObjectFromHandle(org.gnu.glib.Handle)`.

  See Also:
    `getGObjectFromHandle(org.gnu.glib.Handle)`

### getGObjectFromHandle

    public static GObject getGObjectFromHandle(Handle hndl)

  Gets a `GObject` instance for the given `Handle`. If no Java object currently exists for the given `Handle`, this method will return `null`. You should then instantiate the required Java class using the class' handle-constructor. For example:

       // Get a Handle from somewhere (typically as a parameter to a method
       // used as a callback and invoked from the C JNI side).
       SomeGtkClass finalobj = null;
       GObject obj = GObject.getGObjectFromHandle( handle );
       if ( obj == null ) {
           finalobj = new SomeGtkClass( handle );
       } else {
           finalobj = (SomeGtkClass)obj;
       }

  NOTE: This is for internal use only and should never need to be used in application code.

### getNullHandle

    public static final Handle getNullHandle()

  Get a native handle that refers to a null pointer.

### getData

    protected static final java.lang.Object getData(Handle handle,
                                                    java.lang.String key)

### setData

    protected static final void setData(Handle handle,
                                        java.lang.String key,
                                        java.lang.Object data)

### instantiateJGObjectFromGType

    protected static final java.lang.Object instantiateJGObjectFromGType(int type,
                                                                         Handle handle)

### getIntFromHandle

    protected static final int getIntFromHandle(Handle handle)

  Return the int to which the native `Handle` holds a pointer. The native Handle is assumed to hold a C pointer to an int ( gint* ). This method dereferences that pointer and returns the value to which it points as an integer.

  Parameters:
    `handle` - The native Handle holding a pointer to an int.
  Returns:
    The int that is pointed to by the native Handle.

### getStringFromHandle

    protected static final java.lang.String getStringFromHandle(Handle handle)

  Return the String to which the native `Handle` holds a pointer. The native Handle is assumed to hold a C pointer to a String (char* ). This method dereferences that pointer and returns the value to which it points as a String.

  Parameters:
    `handle` - The native Handle holding a pointer to a String.
  Returns:
    The String that is pointed to by the native Handle.