There is no method to get the width on the Label widget or any of the super classes. How would I get the width?
On Aug 16, 5:19 pm, Ian Bambury <[email protected]> wrote: > Just add it, get the width and then place it where you want it. > Ian > > http://examples.roughian.com > > 2009/8/16 Mike Jacobs <[email protected]> > > > > > I have a case where I am dynamically adding a Label widget with > > program determined label text. (It is adding a Label on top of a > > Google Map but this question is about GWT widgets). Since the label > > text can vary at run time and I would like to center the label at a > > specific pixel location, I need to figure out the pixel size of the > > label to position it properly. > > > I can specify a pixel width and height when creating the Label. Is it > > possible to determine the appropriate size of the Label based on the > > label text length? Is is possible to ask the label for it's pixel > > size afterward instead? > > > I have been using a simple approach of using width = text length * 11 > > (since the font is 11px) but that appears to be off by a few pixels > > presumably due to varying width of characters. > > > Thanks, > > Mike --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
