Text is outbound of Label size

Text is outbound of Label size

Forum member · Mar 7, 2007
Hi! Say me please how create a Label so as a text is not outbounded of the Label size.

Re: Text is outbound of Label size

Support · Mar 7, 2007
Hello, There is a getTextWidth() method on the Font object that will give you the required width before creating the label. You pass it a string which is the text your label will display and the font size and it will return the width of the text: Font myFont = Font.Helvetica; float myWidth = myFont.getTextWidth( "My String", 12 ); Then you can reset the width of the label equal to myWidth. If the string is going to be multiline then it is recommended to use TextArea page element. It has getRequiredHeight() method which will return the height required to fit the given text and then reset the Height of the TextArea equal to GetRequiredHeight() and the text will not flow outside the specified width. Thanks, ceTe Software Support Team