Skip to main content


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 14:45
Eclipse UserFriend
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: Thu Apr 25 06:02:11 GMT 2024

Powered by FUDForum. Page generated in 0.03477 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top