Method equivalent to getRequiredHeight()

Method equivalent to getRequiredHeight()

Forum member · Jul 10, 2006
Hi, Is there any way to get information on the required width of the textarea ? Like getRequiredHeight() in FormattedTextArea but for width. I have a text area which has some predefined width x, I don't actully know how much stuff will go into that area but I now it is < x and that it should all stay on one line. Now I need the next textarea to start from the end x - coords of the previous text area. So I need to know what was the resulting width of the previous area.. Do I make any sense, and if so, is this possible ? /tuomo

Re: Method equivalent to getRequiredHeight()

Support · Jul 10, 2006
Hello Tuomo, Yes, you can find out the width of the Text if it is definitely going to be one line. You can determine the exact width using the getTextWidth(java.lang.String text, float fontSize) method on the Font object. It returns the width of the given text for a particular font given the fontSize. Then using this value, you can reset the width of your TextArea and add some padding to it and start the new TextArea. Thanks, ceTe Software Support Team