Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private MenuBar1 As MenuBar
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("menu") 'Only contains a MenuBar
CreateMenus
MainForm.Show
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Public Sub CreateMenus
MenuBar1.Menus.Clear
Dim About As Menu
About.Initialize("About","")
Dim MI As MenuItem
MI.Initialize("Dummy","")
About.MenuItems.Add(MI)
Dim SomethingElse As Menu
SomethingElse.Initialize("Something Else","")
Dim MI As MenuItem
MI.Initialize("Dummy","")
SomethingElse.MenuItems.Add(MI)
MenuBar1.Menus.Add(About)
MenuBar1.Menus.Add(SomethingElse)
SetOnShowing(About)
SetOnShowing(SomethingElse)
End Sub
Private Sub SetOnShowing(Menu1 As JavaObject)
Dim Event As Object = Menu1.CreateEventFromUI("javafx.event.EventHandler","MenuShowing",Null)
Menu1.RunMethod("setOnShowing",Array(Event))
End Sub
Private Sub MenuShowing_Event (MethodName As String, Args() As Object)
Dim M As Menu = Sender
Dim MJO As JavaObject = M
Select M.Text
Case "About"
MJO.RunMethod("hide",Null)
Log(M.Text & " Clicked")
Case "Something Else"
MJO.RunMethod("hide",Null)
Log(M.Text & " Clicked")
End Select
End Sub