### Use Enum Constants

Example of getting an Enum Value for further use (requires the JavaObject library).
TableView Selection Model
Reference: https://docs.oracle.com/javafx/2/api/javafx/scene/control/SelectionMode.html
Example for the Enum SelectionMode with constants MULTIPLE or SINGLE.
'Get the Selection Mode Enum
Dim joSelectionMode As JavaObject
joSelectionMode.InitializeStatic("javafx.scene.control.SelectionMode")
'Get the value of the field MULTIPLE
Log(joSelectionMode.GetField("MULTIPLE"))
'Another way is using valueOf
valueOf(java.lang.String name) = Returns the enum constant of this type with the specified name.
joSelectionMode.RunMethod("valueOf", Array("MULTIPLE"))
'To apply the selection mode to a tableview
As defined in the JavaFX API:
setSelectionMode(SelectionMode value) = Sets the value of the property selectionMode.
Default is SelectionMode.SINGLE.
'Define a JavaObject as TableView and set the selectionmode by using the enum
joTvw.RunMethodJO("getSelectionModel", Null).RunMethod("setSelectionMode", Array(joSelectionMode.RunMethod("valueOf", Array("MULTIPLE"))))
Get all constants of an Enum
Dim sm() As Object = joSelectionMode.RunMethod("values", Null)
'Number of constants
Log(sm.length)
'List the values of the constants
For i = 0 To sm.Length - 1
Log(sm(i))
Next

Changed: , Category: JavaObject, File: T6C208M1527.htm, ID: 1527