Private Sub UpdateClip
If mRound Then
mBase.SetColorAndBorder(mBackgroundColor, 0, 0, Min(mBase.Width / 2, mBase.Height / 2))
Else
mBase.SetColorAndBorder(mBackgroundColor, 0, 0, mCornersRadius)
End If
#if B4J
Dim jo As JavaObject = mBase
Dim shape As JavaObject
If mRound Then
Dim radius As Double = Min(mBase.Width / 2, mBase.Height / 2)
Dim cx As Double = mBase.Width / 2
Dim cy As Double = mBase.Height / 2
shape.InitializeNewInstance("javafx.scene.shape.Circle", Array(cx, cy, radius))
Else
Dim cx As Double = mBase.Width
Dim cy As Double = mBase.Height
shape.InitializeNewInstance("javafx.scene.shape.Rectangle", Array(cx, cy))
If mCornersRadius > 0 Then
Dim d As Double = mCornersRadius
shape.RunMethod("setArcHeight", Array(d))
shape.RunMethod("setArcWidth", Array(d))
End If
End If
jo.RunMethod("setClip", Array(shape))
#else if B4A
Try
Dim jo As JavaObject = mBase
jo.RunMethod("setClipToOutline", Array(mRound Or mCornersRadius > 0))
Catch
'Log(LastException)
End Try
#end if
End Sub