Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private Timer1 As Timer
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
' Create a 3D sphere
Dim sphere As JavaObject
sphere.InitializeNewInstance("javafx.scene.shape.Sphere", Array(100)) ' 100 is the radius of the sphere
' Create a 3D scene
Dim scene As JavaObject
scene.InitializeNewInstance("javafx.scene.Scene", Array(MainForm.RootPane, 800, 600, True))
scene.RunMethod("setFill", Array(fx.Colors.White))
' Add the sphere to the scene
Dim root As JavaObject = scene.RunMethod("getRoot", Null)
root.RunMethod("getChildren", Null).RunMethod("add", Array(sphere))
' Create a PointLight
Dim pointLight As JavaObject
pointLight.InitializeNewInstance("javafx.scene.PointLight", Null)
pointLight.RunMethod("setColor", Array(fx.Colors.White))
pointLight.RunMethod("setTranslateX", Array(200))
pointLight.RunMethod("setTranslateY", Array(-100))
pointLight.RunMethod("setTranslateZ", Array(-300))
' Add the light to the scene
root.RunMethod("getChildren", Null).RunMethod("add", Array(pointLight))
' Set the scene to the form
MainForm.RootPane.RunMethod("setScene", Array(scene))
' Create a RotateTransition for the sphere
Dim rotateTransition As JavaObject
rotateTransition.InitializeNewInstance("javafx.animation.RotateTransition", Array(2000, sphere)) ' 2000 ms duration
rotateTransition.RunMethod("setByAngle", Array(360)) ' Rotate by 360 degrees
rotateTransition.RunMethod("setCycleCount", Array(-1)) ' Infinite loop
rotateTransition.RunMethod("setAutoReverse", Array(False))
' Start the rotation
rotateTransition.RunMethod("play", Null)
End Sub