Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Right-aligned text
Right-aligned text [message #240534] Wed, 09 January 2008 09:45
Eclipse User
Originally posted by: matt.querix.com

Hi all,

This is probably really stupid, but I'm having trouble right-aligning
text in GEF. The text is drawn using graphics.drawText() with a
variable-width font. I tried creating a separate figure for the text,
with the parent having a BorderLayout, and the layout constraint of the
text figure set to BorderLayout.RIGHT. This doesn't work, because when
the paintChildren() method of figure is called, the text figure has a
width of 0, therefore does not intersect with the clip, and does not get
drawn.

I could use FontMetrics to get the average char width, but that won't
work all the time, I need the width of the particular text I want to draw.

Thanks in advance


Matt D.
Previous Topic:Label containg String and Figure, so Figure changes size when Font does
Next Topic:Tooltip extra large
Goto Forum:
  


Current Time: Sat Aug 30 18:43:12 EDT 2014

Powered by FUDForum. Page generated in 0.01801 seconds