java-gnome version 4.0.19

org.gnome.gtk
Class SpinButton

Object
  extended by org.freedesktop.bindings.Pointer
      extended by org.freedesktop.bindings.Proxy
          extended by org.gnome.glib.Object
              extended by org.gnome.gtk.Object
                  extended by org.gnome.gtk.Widget
                      extended by org.gnome.gtk.Entry
                          extended by org.gnome.gtk.SpinButton
All Implemented Interfaces:
CellEditable, Editable

public class SpinButton
extends Entry

A SpinButton is a little text entry used as input for numeric values in a given range. It incorporates two little arrow Buttons that user can click to increment or decrement the value by a given amount.

It is used to let the user introduce the value of a numeric property. This is specially useful when the range of allowed values is unlimited (well, in practise limited by Double.MAX_VALUE!) or only limited at one end. Otherwise, a control like Scale may be a better alternative.

It is also a good idea to add near the SpinButton a Label indicating the units of measure of the property it refers to.

The user can modify the SpinButton either introducing a numeric value in the required range in the text entry, or by clicking the arrow Buttons. The keyboard can also be used, with both the Up and Down, or with the PageUp or PageDown keys. These last decrement or increment the value of the entry by a greater amount (usually ten times the value of the arrow Button step).

The programmer can get the value introduced by the user with the getValue() method. While this method returns a double, by default the SpinButton only allows to introduce integer values. You can use the setDigits() method to change this behaviour.

Version:
4.0.7
Author:
Vreixo Formoso

Nested Class Summary
static interface SpinButton.ValueChanged
          Signal emitted when the value of the SpinButton changes, either by clicking the arrow buttons, by pressing the specified keys, by input a new value on the text entry, or by setting it programmatically with setValue() method.
 
Nested classes/interfaces inherited from class org.gnome.gtk.Entry
Entry.Activate, Entry.Changed, Entry.IconPress, Entry.IconRelease
 
Nested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.EnterNotifyEvent, Widget.ExposeEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.ScrollEvent, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
 
Nested classes/interfaces inherited from class org.gnome.gtk.Object
Object.Destroy
 
Constructor Summary
SpinButton(double min, double max, double step)
          Create a new SpinButton.
 
Method Summary
 void connect(SpinButton.ValueChanged handler)
          Hook up a handler for the SpinButton.ValueChanged signal.
 double getValue()
          Get the current numeric value of the SpinButton.
 void setDigits(int digits)
          Set the number of decimal digits to allow in the entry.
 void setValue(double value)
          Set the value displayed in the text entry.
 
Methods inherited from class org.gnome.gtk.Entry
connect, connect, connect, connect, getCompletion, getIconActivatable, getIconAtPos, getIconIcon, getIconPixbuf, getIconSensitive, getIconStock, getIconStorageType, getIconTooltipMarkup, getIconTooltipText, getMaxLength, getOverwriteMode, getPosition, getProgressFraction, getProgressPulseStep, getSelectionBoundsEnd, getSelectionBoundsStart, getText, getTextLength, getVisibility, progressPulse, selectRegion, setAlignment, setCompletion, setEditable, setHasFrame, setIconActivatable, setIconFromIcon, setIconFromPixbuf, setIconFromStock, setIconSensitive, setIconTooltipMarkup, setIconTooltipText, setInnerBorder, setInvisibleChar, setMaxLength, setOverwriteMode, setPosition, setProgressFraction, setProgressPulseStep, setText, setVisibility, setWidthChars
 
Methods inherited from class org.gnome.gtk.Widget
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getRequisition, getSensitive, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, modifyBackground, modifyBase, modifyFont, modifyText, queueDraw, queueDrawArea, realize, setCanDefault, setCanFocus, setColormap, setEvents, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
 
Methods inherited from class org.gnome.gtk.Object
connect, destroy
 
Methods inherited from class org.freedesktop.bindings.Pointer
toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpinButton

public SpinButton(double min,
                  double max,
                  double step)
Create a new SpinButton.

Parameters:
min - The minimum value allowed.
max - The maximum value allowed.
step - The amount to increment/decrement when one of the arrow Buttons are clicked, or when the user press the Up or Down keys.
Since:
4.0.7
Method Detail

connect

public void connect(SpinButton.ValueChanged handler)
Hook up a handler for the SpinButton.ValueChanged signal.

Since:
4.0.7

getValue

public double getValue()
Get the current numeric value of the SpinButton.

Since:
4.0.7

setDigits

public void setDigits(int digits)
Set the number of decimal digits to allow in the entry. This affects to both the precision of the value displayed and the number of decimal digits the user can introduce in the text entry. You should always give enough digits to represent the step you have chosen, otherwise you will get an undesired behaviour.

Since:
4.0.7

setValue

public void setValue(double value)
Set the value displayed in the text entry. If the given value can't be represented with the selected decimal digits (see setDigits()), the next time user increments or decrements its values the additional digits will be lost, so take care about this.

Since:
4.0.7


java-gnome