### Sample 2

Creates a toolbar with few buttons and adds the toolbar to the rootpane (requires the JavaObject library).
Reference: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/ToolBar.html
Define Global Var as JavaObject:
Private joToolbar As JavaObject
`Sub ToolBar_Create
'Init the toolbar object
joToolbar.InitializeNewInstance("javafx.scene.control.ToolBar", Null)
'Create list of buttons to add to the toolbar
Dim l As List
l.Initialize
For i = 0 To 2
Dim b As Button
b.Initialize("ToolBarButton")
b.Tag = i
b.Text = "Button" & i
l.Add(b)
Next
joToolbar.RunMethodJO("getItems", Null).RunMethod("addAll", Array(l))
MainForm.RootPane.AddNode(joToolbar, 0, 0, -1, -1)
End Sub`
'Handle ToolbarButton Actions
`Sub ToolBarButton_Action
Dim b As Button = Sender
Log("ToolBar Button Clicked = " & b.Tag)
End Sub`

Changed: , Category: ToolBar, File: T6C270M2006.htm, ID: 2006