Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » draw2d: How to get the height of word wrapped text
draw2d: How to get the height of word wrapped text [message #1720438] Mon, 18 January 2016 16:10 Go to next message
Chris Domin is currently offline Chris DominFriend
Messages: 2
Registered: January 2016
Junior Member
So I have the following code:

TextFlow textWrapper = new TextFlow(_title);
FlowPage flowPage = new FlowPage();
flowPage.add(textWrapper);

The standard way of wrapping text. For my project I now need to somehow figure out what the height of this text will be when placed in a container with a fixed width.

This seems simple but I have been unable to figure out how to get this value. A lot of similar threads mention the getPreferedSize() method but this doesn't seem to return the proper height. Any suggestions would be helpful.
Re: draw2d: How to get the height of word wrapped text [message #1720531 is a reply to message #1720438] Tue, 19 January 2016 08:23 Go to previous message
Alexander Nyssen is currently offline Alexander NyssenFriend
Messages: 244
Registered: July 2009
Location: Lünen
Senior Member
I think you may do something like FlowUtilities.getTextLayoutBounds(String, Font, int, int), just that you will need to set the width on the internally used TextLayout to reflect the wrapping.
Previous Topic:To Add Collapse all & Exapnd All button for PaletteDrawer(Container)
Next Topic:Docking palette of widgets within the editor
Goto Forum:
  


Current Time: Sun Sep 22 01:17:22 GMT 2024

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

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

Back to the top