Private Sub UpdateBBLabelHeight(lbl As BBLabel)
Dim par As BCParagraph = lbl.Paragraph
If par.IsInitialized = False Then Return
Dim MaxHeight As Int = lbl.mBase.Height
Dim Rectangle As JavaObject
For Each line As BCTextLine In par.TextLines
If lbl.Padding.Top + (line.BaselineY + line.MaxHeightBelowBaseLine) / TextEngine.mScale > MaxHeight Then
Dim Width As Double = lbl.mBase.Width
Dim Height As Double = lbl.Padding.Top + (line.BaselineY - line.MaxHeightAboveBaseLine) / TextEngine.mScale - 1dip
Rectangle.InitializeNewInstance("javafx.scene.shape.Rectangle", Array(Width, Height))
Exit
End If
Next
lbl.mBase.As(JavaObject).RunMethod("setClip", Array(IIf(Rectangle.IsInitialized, Rectangle, Null)))
End Sub
Private Sub B4XPage_Resize (Width As Int, Height As Int)
UpdateBBLabelHeight(BBLabel1)
End Sub