eu.webtoolkit.jwt
Class WTextItem

java.lang.Object
  extended by eu.webtoolkit.jwt.WTextItem

public class WTextItem
extends java.lang.Object

The result of a font metrics computation.

See Also:
WPaintDevice.measureText(CharSequence text, double maxWidth, boolean wordWrap)

Constructor Summary
WTextItem(java.lang.CharSequence text, double width)
          Constructor.
WTextItem(java.lang.CharSequence text, double width, double nextWidth)
          Constructor.
 
Method Summary
 double getNextWidth()
          Returns the width for a next line-break boundary.
 WString getText()
          Returns the measured text.
 double getWidth()
          Returns the measured width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WTextItem

public WTextItem(java.lang.CharSequence text,
                 double width,
                 double nextWidth)
Constructor.


WTextItem

public WTextItem(java.lang.CharSequence text,
                 double width)
Constructor.

Calls this(text, width, - 1)

Method Detail

getText

public WString getText()
Returns the measured text.

If the item was measured with word breaking enabled, then the text may contain trailing whitespace that is not included in the getWidth().


getWidth

public double getWidth()
Returns the measured width.

Returns the text width, in device local coordinates (pixels).


getNextWidth

public double getNextWidth()
Returns the width for a next line-break boundary.

Returns the width until the next line-break boundary, or -1 if the underlying word boundary analysis does not suppor this.