|
java-gnome version 4.0.19 | ||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.freedesktop.bindings.Pointer
org.freedesktop.bindings.Proxy
org.gnome.glib.Object
org.gnome.gtk.Object
org.gnome.gtk.Widget
org.gnome.gtk.Entry
org.gnome.gtk.SpinButton
public class SpinButton
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.
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.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 |
---|
public SpinButton(double min, double max, double step)
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.Method Detail |
---|
public void connect(SpinButton.ValueChanged handler)
SpinButton.ValueChanged
signal.
public double getValue()
public void setDigits(int digits)
step
you have chosen,
otherwise you will get an undesired behaviour.
public void setValue(double value)
setDigits()
), the next time user increments or
decrements its values the additional digits will be lost, so take care
about this.
|
![]() java-gnome |
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |