Sub MeasureText(Text As String,TFont As Font) As TextMetric
Dim TB, Bounds As JavaObject
Dim TM As TextMetric
Bounds = TB.RunMethodJO("create",Null).RunMethodJO("text",Array(Text)).RunMethodJO("font",Array(TFont)).RunMethodJO("build",Null).RunMethodJO("getLayoutBounds",Null)
TM.Width = Bounds.RunMethod("getWidth",Null)
TM.Height = Bounds.RunMethod("getHeight",Null)
Return TM
End Sub