### Create Spinner Control (JavaObject)

Example of creating a Spinner Control (requires the JavaObject library).
Reference: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/Spinner.html
A Spinner is added to a Form Pane, e.g. for a MainForm like MainForm.RootPane.
' Define the JavaObject for the Spinner
`Sub Process_Globals
Private joSpinnerGPIO As JavaObject
End Sub`
`Subs to add a Spinner, get the Spinner value or set the Spinner Value
' Add a SpinnerTextField to the RootPane
' Example:
' addSpinner(joSpinnerGPIO, MainForm.RootPane, 20, 100, 100, 20, 0, 29, 10)
`Sub addSpinner(joSpinner As JavaObject, p As Pane, l As Double, t As Double, w As Double, h As Double, minvalue As Int, maxvalue As Int, value As Int)
Dim spMin As Double = minvalue
Dim spMax As Double = maxvalue
Dim spInitialValue As Double = value
Dim spAmountToStepBy As Double = 1
joSpinner.InitializeNewInstance("javafx.scene.control.Spinner", Array(spMin, spMax, spInitialValue, spAmountToStepBy))
p.AddNode(joSpinner, l,t,w,h)
End Sub`
'Get the value of the SpinnerTextField
'Example:
' Private joSpinnerGPIO As JavaObject
' Log("Spinner Value for joSpinnerGPIO:" & getSpinnerValue(joSpinnerGPIO))
`Sub getSpinnerValue(joSpinner As JavaObject) As Double
Return joSpinner.RunMethodJO("getValueFactory", Null).RunMethod("getValue", Null)
End Sub`
'Set the value of the SpinnerTextField
'Example:
' Private joSpinnerGPIO As JavaObject
' setSpinnerValue(joSpinnerGPIO, 9)
`Sub setSpinnerValue(joSpinner As JavaObject, value As Double)
joSpinner.RunMethodJO("getValueFactory", Null).RunMethod("setValue", Array(value))
End Sub`
End Region
`

Changed: , Category: Spinner, File: T6C252M1810.htm, ID: 1810