B4J Question Passing array of JavaObjects as a parameter - Constructor not found

jdkellow

Member
Licensed User
Longtime User
I have been using JavaObject to access classes in an an #AdditionalJar and have many classes working correctly.

In this example I am passing an array of JavaObject created in lines 46-52 (working correctly) to a new instance of a class defined as
upload_2014-9-9_10-51-33.png


upload_2014-9-9_10-37-22.png


I am now getting an error on line 55 - Constructor not found

I can't see any other way of passing the basepoints array of JavaObject's to the new class - any suggestions would be appreciated

Cheers,
John Davidson
 

Daestrum

Expert
Licensed User
Longtime User
Have you tried
Array as Object(Array as Object(basepoints),6)
 
Last edited:
Upvote 0

jdkellow

Member
Licensed User
Longtime User
Thanks for the reply - I have tried using InitializeArray for the two arrays, both and separately, but still get errors - e.g.

Dim hexagon(6) As JavaObject ' an array of 6 WB_Point objects
For I= 0 To 5
hexagon(I).InitializeNewInstance("wblut.geom.WB_Point",Array As Object(0.0,100.0,0.0))
If I>0 Then
hexagon(I).RunMethod("rotateAboutAxis",Array(PI/3.0*I,0.0,0.0,0.0,0.0,0.0,1.0))
End If
Next

Dim polygons(7) As JavaObject ' An array of 7 hexagons (each an array of 6 WB_Point objects)
polygons(0).InitializeArray("wblut.geom.WB_SimplePolygon",Array As Object(hexagon))


gives a runtime error of
java.lang.IllegalArgumentException: array element type mismatch

It is difficult to understand what the Values() can be on .InitializeArray - is it possible to give more explanation?
 
Upvote 0
Top