### Sample 1

To create a ToolBar with Buttons using API methods (requires the JavaObject library).
Reference: https://docs.oracle.com/javafx/2/api/javafx/scene/control/ToolBar.html
The defined Sub CreateToolBar can be called f.e. AppStart after MainForm.Show.
`Sub CreateToolBar
Dim joToolBar As JavaObject
Dim B1 As Button:B1.Initialize("B1"):B1.Text="Button 1":B1.TextColor=fx.Colors.Red
Dim B2 As Button:B2.Initialize("B2"):B2.Text="Button 2":B2.TextColor=fx.Colors.Blue
joToolBar.InitializeNewInstance("javafx.scene.control.ToolBar", Null)
joToolBar.RunMethodJO("getItems", Null).runMethod("add", Array(B1))
joToolBar.RunMethodJO("getItems", Null).runMethod("add", Array(B2))
joToolBar.RunMethod("setStyle", Array("-fx-background-color: yellow;"))
MainForm.RootPane.AddNode(joToolBar, 10, 10, 300, 50)
End Sub`
`Sub B1_Action
Log("Button1 clicked")
End Sub`
`Sub B2_Action
Log("Button2 clicked")
End Sub`
Handle Form Resize
`Sub Process_Globals
...
Dim joToolBar As JavaObject
...
End Sub`
then
`Sub MainForm_Resize (Width As Double, Height As Double)
joToolBar.RunMethod("setPrefWidth", Array(Width))
End Sub`

Changed: , Category: ToolBar, File: T6C270M2005.htm, ID: 2005