Sub TrayIconSetEnabled(Index As Int, Enabled As Boolean)
Dim jo As JavaObject = Tray 'Tray is the SystemTray object
Dim TrayIconS() As Object = jo.GetFieldJO("st").RunMethod("getTrayIcons", Null)
Dim ti As JavaObject = TrayIconS(0) 'assuming that there is a single icon
Dim popup As JavaObject = ti.RunMethod("getPopupMenu", Null)
popup.RunMethodJO("getItem", Array(Index)).RunMethod("setEnabled", Array(Enabled))
End Sub