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.
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.
adjustment
- An Adjustment
object to use.climbRate
- The new climb rate.digits
- The number of decimal places to display in the spin button.
fireSpinEvent
protected void fireSpinEvent(SpinEvent event)
getAdjustment
public Adjustment getAdjustment()
Returns the Adjustment ojbect used with this object.
- the adjustment object for this SpinButton
getEventListenerClass
public Class getEventListenerClass(String signal)
- getEventListenerClass in interface Entry
getEventType
public EventType getEventType(String signal)
- getEventType in interface Entry
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()
.
- Current value of SpinButton, as an integer
getType
public static Type getType()
Retrieve the runtime type used by the GLib library.
- getType in interface Entry
getValue
public double getValue()
Get the value of the SpinButton
- The current value
gtk_spin_button_configure
protected static final void gtk_spin_button_configure(Handle spin_button,
Handle adjustment,
double climbRate,
int digits)
gtk_spin_button_get_adjustment
protected static final Handle gtk_spin_button_get_adjustment(Handle spin_button)
gtk_spin_button_get_digits
protected static final int gtk_spin_button_get_digits(Handle spin_button)
gtk_spin_button_get_increments
protected static final void gtk_spin_button_get_increments(Handle spin_button,
double[] step,
double[] page)
gtk_spin_button_get_numeric
protected static final boolean gtk_spin_button_get_numeric(Handle spin_button)
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_snap_to_ticks
protected static final boolean gtk_spin_button_get_snap_to_ticks(Handle spin_button)
gtk_spin_button_get_type
protected static final int gtk_spin_button_get_type()
gtk_spin_button_get_update_policy
protected static final int gtk_spin_button_get_update_policy(Handle spin_button)
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_get_wrap
protected static final boolean gtk_spin_button_get_wrap(Handle spin_button)
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_set_digits
protected static final void gtk_spin_button_set_digits(Handle spin_button,
int digits)
gtk_spin_button_set_increments
protected static final void gtk_spin_button_set_increments(Handle spin_button,
double step,
double page)
gtk_spin_button_set_numeric
protected static final void gtk_spin_button_set_numeric(Handle spin_button,
boolean numeric)
gtk_spin_button_set_range
protected static final void gtk_spin_button_set_range(Handle spin_button,
double min,
double max)
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_set_update_policy
protected static final void gtk_spin_button_set_update_policy(Handle spin_button,
int policy)
gtk_spin_button_set_value
protected static final void gtk_spin_button_set_value(Handle spin_button,
double value)
gtk_spin_button_set_wrap
protected static final void gtk_spin_button_set_wrap(Handle spin_button,
boolean wrap)
gtk_spin_button_spin
protected static final void gtk_spin_button_spin(Handle spin_button,
int direction,
double increment)
gtk_spin_button_update
protected static final void gtk_spin_button_update(Handle spin_button)
setAdjustment
public void setAdjustment(Adjustment adjustment)
Replaces the adjustment object associated with the Spin button
adjustment
- New adjustment object to use
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.
step
- Increment applied for a button 1 press.page
- Increment applied for a button 2 press.
setNumeric
public void setNumeric(boolean numeric)
Sets the flag that determines if non-numeric text can be typed
in the spin button.
numeric
- Set the flag to true or false.
setPrecision
public void setPrecision(int digits)
Set the precision to be displayed. Up to 20 digit precision is allowed.
digits
- Number of digits to be displayed
setRange
public void setRange(double min,
double max)
Sets the minimum and maximum allowable values
min
- Minimum allowable value.max
- Maximum allowable value.
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.
snapToTicks
- A flag indicating if invalid values should be corrected.
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.
policy
- An update Policy
setValue
public void setValue(double value)
Sets the value of the spin button
value
- The value for the SpinButton
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.
wrap
- If true, the value will wrap
spin
public void spin(SpinType direction,
double increment)
Increment or decrement a spin button's value in a specified direction
by a specified amount.
direction
- A SpinType
indicating the direction to spin.increment
- Step increment to apply in the specified direction.