Example: JavaObject class

This script prints the area of a 2 X 4 rectangle. Then, with the use of setValue, it resets the width and height and prints the new size.

Dim mySession As JavaSession
Dim myClass As JavaClass
Dim myProperty As JavaProperty
Dim myObject As JavaObject

Set mySession = new JavaSession()

' setProperty on custom class
Set myClass = _
mySession.GetClass("valid5/javaconn/java/Rectangle;")
Set myObject = myClass.CreateObject("(II)V", 2,4)

print "The area of our Rectangle (2 X 4) is " & _
myObject.getArea()

Set myProperty = myClass.GetProperty("width")
call myProperty.setValue(5,o)
Set myProperty = myClass.GetProperty("height")
call myProperty.setValue(10,o)
	
Print "The area of our Rectangle (5 X 10) is " & _
myObject.getArea()