org.gnu.gtk
Class ToggleButton

java.lang.Object
  extended by org.gnu.glib.Struct
      extended by org.gnu.glib.GObject
          extended by org.gnu.gtk.GtkObject
              extended by org.gnu.gtk.Widget
                  extended by org.gnu.gtk.Container
                      extended by org.gnu.gtk.Bin
                          extended by org.gnu.gtk.Button
                              extended by org.gnu.gtk.ToggleButton
Direct Known Subclasses:
CheckButton

public class ToggleButton
extends Button

A ToggleButton is a button that changes and retains its on or off state each time it is selected with the mouse. When in the on state, it will appear to be pressed in.

See Also:
CheckButton, RadioButton, Button

Constructor Summary
ToggleButton()
          Creates a new toggle button.
ToggleButton(org.gnu.glib.Handle handle)
          Construct a toggle button using a handle to a native resource.
ToggleButton(java.lang.String label, boolean hasMnemonic)
          Creates a new toggle button with a text label.
 
Method Summary
 void addListener(ToggleListener listener)
          Register an object to handle button events.
 java.lang.Class getEventListenerClass(java.lang.String signal)
           
 EventType getEventType(java.lang.String signal)
           
 boolean getInconsistent()
          Return whether this is in the inconsistent state
 boolean getState()
          Returns the state of the toggle button
static ToggleButton getToggleButton(org.gnu.glib.Handle handle)
          Internal static factory method to be used by Java-Gnome only.
static Type getType()
          Retrieve the runtime type used by the GLib library.
 void removeListener(ToggleListener listener)
          Removes a listener
 void setInconsistent(boolean isInconsistent)
          Determines whether the toggle button should be in the half-on, or inconsistent state.
 void setState(boolean state)
          Modifies the state of the toggle button
 
Methods inherited from class org.gnu.gtk.Button
addListener, click, enter, getButton, getFocusOnClick, getImage, getLabel, getRelief, getUseStock, getUseUnderline, getXAlignment, getYAlignment, leave, press, release, removeListener, setAlignment, setFocusOnClick, setImage, setLabel, setRelief, setUseStock, setUseUnderline
 
Methods inherited from class org.gnu.gtk.Bin
getChild
 
Methods inherited from class org.gnu.gtk.Container
add, addListener, getBooleanChildProperty, getBorderWidth, getChildProperty, getChildren, getIntChildProperty, getResizeMode, remove, removeListener, resizeChildren, setBooleanChildProperty, setBorderWidth, setChildProperty, setIntChildProperty, setResizeMode
 
Methods inherited from class org.gnu.gtk.Widget
activate, addAccelerator, addEvents, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, canActivateAccel, createContext, createLayout, draw, drawArea, drawArea, finish, getAccessible, getAllocation, getCanFocus, getColormap, getContext, getData, getDisplay, getDragData, getExtensionEvents, getModifierStyle, getName, getParent, getParentWindow, getPointer, getRootWindow, getScreen, getSensitive, getStyle, getToplevel, getWidget, getWindow, grabDefault, grabFocus, hasFocus, hasScreen, hide, hideAll, highlight, highlight, intersect, isAncestor, makeWidget, modifyStyle, popColormap, pushColormap, realize, removeAccelerator, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, reparent, setBackgroundColor, setBaseColor, setCanFocus, setColormap, setDoubleBuffered, setDragDestination, setDragIcon, setDragIconPixbuf, setDragIconStock, setDragSource, setEvents, setExtensionEvents, setFont, setForegroundColor, setMinimumSize, setName, setNoDragDestination, setNoDragSource, setSensitive, setTextColor, shapeCombineMask, show, showAll, unHighlight, unHighlight
 
Methods inherited from class org.gnu.gtk.GtkObject
destroy, sink
 
Methods inherited from class org.gnu.glib.GObject
addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, collect, freezeNotify, getBooleanProperty, getData, getDoubleProperty, getFloatProperty, getGObjectFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getPixbufProperty, getProperty, getStringProperty, hasProperty, notify, removeEventHandler, removeListener, setBooleanProperty, setData, setDoubleProperty, setFloatProperty, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify
 
Methods inherited from class org.gnu.glib.Struct
equals, getHandle, getNullHandle, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToggleButton

public ToggleButton()
Creates a new toggle button.


ToggleButton

public ToggleButton(org.gnu.glib.Handle handle)
Construct a toggle button using a handle to a native resource.


ToggleButton

public ToggleButton(java.lang.String label,
                    boolean hasMnemonic)
Creates a new toggle button with a text label. If the hasMnemonic Label is set, the button is assumes to contain mnemonic characters; that is characters which are preceeded by an underscore. These will appear underlined and will be used as keyboard accelerators.

Parameters:
label - The text to be displayed on the button
hasMnemonic - If true, keyboeard accelerators will be interpreted.
Method Detail

getToggleButton

public static ToggleButton getToggleButton(org.gnu.glib.Handle handle)
Internal static factory method to be used by Java-Gnome only.


setState

public void setState(boolean state)
Modifies the state of the toggle button

Parameters:
state - If true, the button is in the 'on', or 'pressed in' state.

getState

public boolean getState()
Returns the state of the toggle button

Returns:
True if the button is on or 'pressed in'.

setInconsistent

public void setInconsistent(boolean isInconsistent)
Determines whether the toggle button should be in the half-on, or inconsistent state. This is envirely a visual setting - changes to this will not affect the state of the button as returned by getState().

Parameters:
isInconsistent - If true, the button will appear in the in-between state.

getInconsistent

public boolean getInconsistent()
Return whether this is in the inconsistent state

Returns:
True if the 'inbetween' state is in use
See Also:
setInconsistent(boolean)

addListener

public void addListener(ToggleListener listener)
Register an object to handle button events.

See Also:
ToggleListener

removeListener

public void removeListener(ToggleListener listener)
Removes a listener

See Also:
addListener(ToggleListener)

getEventListenerClass

public java.lang.Class getEventListenerClass(java.lang.String signal)
Overrides:
getEventListenerClass in class Button

getEventType

public EventType getEventType(java.lang.String signal)
Overrides:
getEventType in class Button

getType

public static Type getType()
Retrieve the runtime type used by the GLib library.