org.gnu.gtk
Class SpinButton

java.lang.Object
  extended byorg.gnu.glib.GObject
      extended byorg.gnu.gtk.GtkObject
          extended byorg.gnu.gtk.Widget
              extended byorg.gnu.gtk.Entry
                  extended byorg.gnu.gtk.SpinButton
All Implemented Interfaces:
Editable

public class SpinButton
extends Entry

A SpinButton widget displays a single numeric value that you can change by using the two arrow buttons to its right, or by editing the number directly.


Field Summary
 
Fields inherited from class org.gnu.glib.GObject
eventsInitialized
 
Constructor Summary
SpinButton(Adjustment adjustment, double climbRate, int digits)
          Creates a new SpinButton
SpinButton(double min, double max, double step)
          Creates a new SpinButton without manually creating an adjustment.
SpinButton(Handle handle)
          Construct a new SpinButton from a handle to a native resource.
 
Method Summary
 void addListener(SpinListener listener)
          Register an object to handle spin events.
 void configure(Adjustment adjustment, double climbRate, int digits)
          Changes the properties of an existing spin button.
protected  void fireSpinEvent(SpinEvent event)
           
 Adjustment getAdjustment()
          Returns the Adjustment ojbect used with this object.
 java.lang.Class getEventListenerClass(java.lang.String signal)
           
 EventType getEventType(java.lang.String signal)
           
 int getIntValue()
          Returns the current value, as an integer.
static Type getType()
          Retrieve the runtime type used by the GLib library.
 double getValue()
          Get the value of the SpinButton
protected static void gtk_spin_button_configure(Handle spin_button, Handle adjustment, double climbRate, int digits)
           
protected static Handle gtk_spin_button_get_adjustment(Handle spin_button)
           
protected static int gtk_spin_button_get_digits(Handle spin_button)
           
protected static void gtk_spin_button_get_increments(Handle spin_button, double[] step, double[] page)
           
protected static boolean gtk_spin_button_get_numeric(Handle spin_button)
           
protected static void gtk_spin_button_get_range(Handle spin_button, double[] min, double[] max)
           
protected static boolean gtk_spin_button_get_snap_to_ticks(Handle spin_button)
           
protected static int gtk_spin_button_get_type()
           
protected static int gtk_spin_button_get_update_policy(Handle spin_button)
           
protected static int gtk_spin_button_get_value_as_int(Handle spin_button)
           
protected static double gtk_spin_button_get_value(Handle spin_button)
           
protected static boolean gtk_spin_button_get_wrap(Handle spin_button)
           
protected static Handle gtk_spin_button_new_with_range(double min, double max, double step)
           
protected static Handle gtk_spin_button_new(Handle adjustment, double climbRate, int digits)
           
protected static void gtk_spin_button_set_adjustment(Handle spin_button, Handle adjustment)
           
protected static void gtk_spin_button_set_digits(Handle spin_button, int digits)
           
protected static void gtk_spin_button_set_increments(Handle spin_button, double step, double page)
           
protected static void gtk_spin_button_set_numeric(Handle spin_button, boolean numeric)
           
protected static void gtk_spin_button_set_range(Handle spin_button, double min, double max)
           
protected static void gtk_spin_button_set_snap_to_ticks(Handle spin_button, boolean snapToTicks)
           
protected static void gtk_spin_button_set_update_policy(Handle spin_button, int policy)
           
protected static void gtk_spin_button_set_value(Handle spin_button, double value)
           
protected static void gtk_spin_button_set_wrap(Handle spin_button, boolean wrap)
           
protected static void gtk_spin_button_spin(Handle spin_button, int direction, double increment)
           
protected static void gtk_spin_button_update(Handle spin_button)
           
 void removeListener(SpinListener listener)
          Removes a listener
 void setAdjustment(Adjustment adjustment)
          Replaces the adjustment object associated with the Spin button
 void setIncrements(double step, double page)
          Sets the step and page increments.
 void setNumeric(boolean numeric)
          Sets the flag that determines if non-numeric text can be typed in the spin button.
 void setPrecision(int digits)
          Set the precision to be displayed.
 void setRange(double min, double max)
          Sets the minimum and maximum allowable values
 void setSnap(boolean snapToTicks)
          Sets the policy as to whether values are corrected to the nearest step increment when a spin button is activated after providing an invalid value.
 void setUpdatePolicy(SpinButtonUpdatePolicy policy)
          Sets the update behavior of a spin button.
 void setValue(double value)
          Sets the value of the spin button
 void setWrap(boolean wrap)
          Sets the flag that determines if a spin button value wraps around to the opposite limit when the upper or lower limit of the range is exceeded.
 void spin(SpinType direction, double increment)
          Increment or decrement a spin button's value in a specified direction by a specified amount.
 
Methods inherited from class org.gnu.gtk.Entry
addListener, copyClipboard, cutClipboard, deleteSelection, deleteText, fireEntryEvent, getAlignment, getCharacters, getCompletion, getCursorPosition, getEditable, getHasFrame, getLayout, getLayoutOffsets, getMaxLength, getText, getVisible, getWidth, gtk_entry_get_activates_default, gtk_entry_get_completion, gtk_entry_get_has_frame, gtk_entry_get_invisible_char, gtk_entry_get_layout_offsets, gtk_entry_get_layout, gtk_entry_get_max_length, gtk_entry_get_text, gtk_entry_get_type, gtk_entry_get_visibility, gtk_entry_get_width_chars, gtk_entry_new, gtk_entry_set_activates_default, gtk_entry_set_completion, gtk_entry_set_has_frame, gtk_entry_set_invisible_char, gtk_entry_set_max_length, gtk_entry_set_text, gtk_entry_set_visibility, gtk_entry_set_width_chars, handleToggleOverwrite, insertText, layoutIndexToTextIndex, pasteClipboard, removeListener, selectRegion, setActivateDefaultWidget, setAlignment, setCompletion, setCursorPosition, setEditable, setHasFrame, setInvisibleChar, setMaxLength, setText, setVisible, setWidth, textIndexToLayoutIndex
 
Methods inherited from class org.gnu.gtk.Widget
activate, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, canActivateAccel, createContext, createLayout, destroy, draw, drawArea, drawArea, findListener, finish, fireBooleanLifeCycleEvent, fireDragDestinationEvent, fireDragSourceEvent, fireExposeEvent, fireFocusEvent, fireKeyEvent, fireLifeCycleEvent, fireMouseEvent, fireMouseMotionEvent, getAccessible, getColormap, getContext, getData, getDisplay, getModifierStyle, getName, getParent, getParentWindow, getPointer, getRootWindow, getScreen, getSensitive, getStyle, getToplevel, getWindow, grabDefault, grabFocus, gtk_drag_dest_set, gtk_drag_dest_unset, gtk_drag_finish, gtk_drag_get_data, gtk_drag_highlight, gtk_drag_source_set_icon_pixbuf, gtk_drag_source_set_icon_stock, gtk_drag_source_set_icon, gtk_drag_source_set, gtk_drag_source_unset, gtk_drag_unhighlight, gtk_widget_activate, gtk_widget_add_accelerator, gtk_widget_add_events, gtk_widget_add_mnemonic_label, gtk_widget_can_activate_accel, gtk_widget_child_focus, gtk_widget_child_notify, gtk_widget_class_path, gtk_widget_create_pango_context, gtk_widget_create_pango_layout, gtk_widget_destroy, gtk_widget_destroyed, gtk_widget_ensure_style, gtk_widget_event, gtk_widget_freeze_child_notify, gtk_widget_get_accessible, gtk_widget_get_ancestor, gtk_widget_get_child_requisition, gtk_widget_get_child_visible, gtk_widget_get_colormap, gtk_widget_get_composite_name, gtk_widget_get_default_colormap, gtk_widget_get_default_direction, gtk_widget_get_default_style, gtk_widget_get_default_visual, gtk_widget_get_direction, gtk_widget_get_display, gtk_widget_get_events, gtk_widget_get_extension_events, gtk_widget_get_modifier_style, gtk_widget_get_name, gtk_widget_get_pango_context, gtk_widget_get_parent_window, gtk_widget_get_parent, gtk_widget_get_pointer, gtk_widget_get_root_window, gtk_widget_get_screen, gtk_widget_get_sensitive, gtk_widget_get_settings, gtk_widget_get_size_request, gtk_widget_get_style, gtk_widget_get_toplevel, gtk_widget_get_type, gtk_widget_get_visual, gtk_widget_get_window, gtk_widget_grab_default, gtk_widget_grab_focus, gtk_widget_has_screen, gtk_widget_hide_all, gtk_widget_hide_on_delete, gtk_widget_hide, gtk_widget_intersect, gtk_widget_is_ancestor, gtk_widget_is_focus, gtk_widget_list_accel_closures, gtk_widget_list_mnemonic_labels, gtk_widget_map, gtk_widget_mnemonic_activate, gtk_widget_modify_base, gtk_widget_modify_bg, gtk_widget_modify_fg, gtk_widget_modify_font, gtk_widget_modify_style, gtk_widget_modify_text, gtk_widget_path, gtk_widget_pop_colormap, gtk_widget_pop_composite_child, gtk_widget_push_colormap, gtk_widget_push_composite_child, gtk_widget_queue_draw_area, gtk_widget_queue_draw, gtk_widget_queue_resize, gtk_widget_realize, gtk_widget_ref, gtk_widget_region_intersect, gtk_widget_remove_accelerator, gtk_widget_remove_mnemonic_label, gtk_widget_render_icon, gtk_widget_reparent, gtk_widget_reset_rc_styles, gtk_widget_send_expose, gtk_widget_set_accel_path, gtk_widget_set_app_paintable, gtk_widget_set_child_visible, gtk_widget_set_colormap, gtk_widget_set_composite_name, gtk_widget_set_default_colormap, gtk_widget_set_default_direction, gtk_widget_set_direction, gtk_widget_set_double_buffered, gtk_widget_set_events, gtk_widget_set_extension_events, gtk_widget_set_name, gtk_widget_set_parent_window, gtk_widget_set_parent, gtk_widget_set_redraw_on_allocate, gtk_widget_set_scroll_adjustments, gtk_widget_set_sensitive, gtk_widget_set_size_request, gtk_widget_set_state, gtk_widget_set_style, gtk_widget_shape_combine_mask, gtk_widget_show_all, gtk_widget_show_now, gtk_widget_show, gtk_widget_size_allocate, gtk_widget_size_request, gtk_widget_style_get_property, gtk_widget_thaw_child_notify, gtk_widget_translate_coordinates, gtk_widget_unmap, gtk_widget_unparent, gtk_widget_unrealize, gtk_widget_unref, handleButtonPressed, handleButtonReleased, handleDelete, handleDragDataGet, handleDragDestination, handleExpose, handleFocusIn, handleFocusOut, handleHide, handleKeyPressed, handleKeyReleased, handleMap, handleMouseEnter, handleMouseLeave, handleMouseMotion, handleNoExpose, handleRealize, handleScroll, handleShow, handleUnmap, hasFocus, hasScreen, hide, hideAll, highlight, intersect, isAncestor, makeWidget, modifyStyle, popColormap, pushColormap, realize, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, reparent, setBackgroundColor, setBaseColor, setColormap, setDoubleBuffered, setDragDestination, setDragIcon, setDragIconPixbuf, setDragIconStock, setDragSource, setFont, setForegroundColor, setMinimumSize, setName, setNoDragDestination, setNoDragSource, setSensitive, setTextColor, shapeCombineMask, show, showAll, unHighlight
 
Methods inherited from class org.gnu.gtk.GtkObject
getFlags, gtk_object_destroy, gtk_object_get_type, gtk_object_sink, setFlags, sink
 
Methods inherited from class org.gnu.glib.GObject
addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, equals, freezeNotify, getBooleanProperty, getData, getData, getDoubleProperty, getFloatProperty, getGObjectFromHandle, getHandle, getIntFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getNullHandle, getPixbufProperty, getProperty, getStringFromHandle, getStringProperty, hashCode, hasProperty, instantiateJGObjectFromGType, notify, removeEventHandler, removeListener, retrieveGObject, setBooleanProperty, setData, setData, setDoubleProperty, setFloatProperty, setHandle, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpinButton

public SpinButton(Adjustment adjustment,
                  double climbRate,
                  int digits)
Creates a new SpinButton

Parameters:
adjustment - The Adjustment object that this spin button should use.
climbRate - Specifies how much the spin button changes when an arrow is clicked on.
digits - The number of decimal places to display.

SpinButton

public SpinButton(double min,
                  double max,
                  double step)
Creates a new SpinButton without manually creating an adjustment. The value is initially set to the minimum value and a page increment of 10 * step is the default. The precision of the spin button is equivalent to the precision of step.

Parameters:
min - Minimum allowable value
max - Maximum allowable value
step - Increment added or subtracted by spinning the widget

SpinButton

public SpinButton(Handle handle)
Construct a new SpinButton from a handle to a native resource.

Method Detail

configure

public void configure(Adjustment adjustment,
                      double climbRate,
                      int digits)
Changes the properties of an existing spin button. The adjustment, climb rate, and number of decimal places are all changed accordingly, after this function call.

Parameters:
adjustment - An Adjustment object to use.
climbRate - The new climb rate.
digits - The number of decimal places to display in the spin button.

setAdjustment

public void setAdjustment(Adjustment adjustment)
Replaces the adjustment object associated with the Spin button

Parameters:
adjustment - New adjustment object to use

getAdjustment

public Adjustment getAdjustment()
Returns the Adjustment ojbect used with this object.

Returns:
the adjustment object for this SpinButton

setPrecision

public void setPrecision(int digits)
Set the precision to be displayed. Up to 20 digit precision is allowed.

Parameters:
digits - Number of digits to be displayed

setIncrements

public void setIncrements(double step,
                          double page)
Sets the step and page increments. This affects how quickly the value changes when the spin button's arrows are activated.

Parameters:
step - Increment applied for a button 1 press.
page - Increment applied for a button 2 press.

setRange

public void setRange(double min,
                     double max)
Sets the minimum and maximum allowable values

Parameters:
min - Minimum allowable value.
max - Maximum allowable value.

getIntValue

public int getIntValue()
Returns the current value, as an integer. The value is stored as a double - this method converts it to an integer. To get the raw double value, use getValue().

Returns:
Current value of SpinButton, as an integer

setValue

public void setValue(double value)
Sets the value of the spin button

Parameters:
value - The value for the SpinButton

setUpdatePolicy

public void setUpdatePolicy(SpinButtonUpdatePolicy policy)
Sets the update behavior of a spin button. This determines whether the spin button is always updated or only when a valid value is set.

Parameters:
policy - An update Policy

spin

public void spin(SpinType direction,
                 double increment)
Increment or decrement a spin button's value in a specified direction by a specified amount.

Parameters:
direction - A SpinType indicating the direction to spin.
increment - Step increment to apply in the specified direction.

setWrap

public void setWrap(boolean wrap)
Sets the flag that determines if a spin button value wraps around to the opposite limit when the upper or lower limit of the range is exceeded.

Parameters:
wrap - If true, the value will wrap

setSnap

public void setSnap(boolean snapToTicks)
Sets the policy as to whether values are corrected to the nearest step increment when a spin button is activated after providing an invalid value.

Parameters:
snapToTicks - A flag indicating if invalid values should be corrected.

getValue

public double getValue()
Get the value of the SpinButton

Returns:
The current value

setNumeric

public void setNumeric(boolean numeric)
Sets the flag that determines if non-numeric text can be typed in the spin button.

Parameters:
numeric - Set the flag to true or false.

addListener

public void addListener(SpinListener listener)
Register an object to handle spin events.

See Also:
SpinListener

removeListener

public void removeListener(SpinListener listener)
Removes a listener

See Also:
addListener(SpinListener)

fireSpinEvent

protected void fireSpinEvent(SpinEvent event)

getEventListenerClass

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

getEventType

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

getType

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


gtk_spin_button_get_type

protected static final int gtk_spin_button_get_type()

gtk_spin_button_configure

protected static final void gtk_spin_button_configure(Handle spin_button,
                                                      Handle adjustment,
                                                      double climbRate,
                                                      int digits)

gtk_spin_button_new

protected static final Handle gtk_spin_button_new(Handle adjustment,
                                                  double climbRate,
                                                  int digits)

gtk_spin_button_new_with_range

protected static final Handle gtk_spin_button_new_with_range(double min,
                                                             double max,
                                                             double step)

gtk_spin_button_set_adjustment

protected static final void gtk_spin_button_set_adjustment(Handle spin_button,
                                                           Handle adjustment)

gtk_spin_button_get_adjustment

protected static final Handle gtk_spin_button_get_adjustment(Handle spin_button)

gtk_spin_button_set_digits

protected static final void gtk_spin_button_set_digits(Handle spin_button,
                                                       int digits)

gtk_spin_button_get_digits

protected static final int gtk_spin_button_get_digits(Handle spin_button)

gtk_spin_button_set_increments

protected static final void gtk_spin_button_set_increments(Handle spin_button,
                                                           double step,
                                                           double page)

gtk_spin_button_get_increments

protected static final void gtk_spin_button_get_increments(Handle spin_button,
                                                           double[] step,
                                                           double[] page)

gtk_spin_button_set_range

protected static final void gtk_spin_button_set_range(Handle spin_button,
                                                      double min,
                                                      double max)

gtk_spin_button_get_range

protected static final void gtk_spin_button_get_range(Handle spin_button,
                                                      double[] min,
                                                      double[] max)

gtk_spin_button_get_value

protected static final double gtk_spin_button_get_value(Handle spin_button)

gtk_spin_button_get_value_as_int

protected static final int gtk_spin_button_get_value_as_int(Handle spin_button)

gtk_spin_button_set_value

protected static final void gtk_spin_button_set_value(Handle spin_button,
                                                      double value)

gtk_spin_button_set_update_policy

protected static final void gtk_spin_button_set_update_policy(Handle spin_button,
                                                              int policy)

gtk_spin_button_get_update_policy

protected static final int gtk_spin_button_get_update_policy(Handle spin_button)

gtk_spin_button_set_numeric

protected static final void gtk_spin_button_set_numeric(Handle spin_button,
                                                        boolean numeric)

gtk_spin_button_get_numeric

protected static final boolean gtk_spin_button_get_numeric(Handle spin_button)

gtk_spin_button_spin

protected static final void gtk_spin_button_spin(Handle spin_button,
                                                 int direction,
                                                 double increment)

gtk_spin_button_set_wrap

protected static final void gtk_spin_button_set_wrap(Handle spin_button,
                                                     boolean wrap)

gtk_spin_button_get_wrap

protected static final boolean gtk_spin_button_get_wrap(Handle spin_button)

gtk_spin_button_set_snap_to_ticks

protected static final void gtk_spin_button_set_snap_to_ticks(Handle spin_button,
                                                              boolean snapToTicks)

gtk_spin_button_get_snap_to_ticks

protected static final boolean gtk_spin_button_get_snap_to_ticks(Handle spin_button)

gtk_spin_button_update

protected static final void gtk_spin_button_update(Handle spin_button)