org.nakedobjects.plugins.dnd.viewer
Class AwtText

java.lang.Object
  extended by org.nakedobjects.plugins.dnd.viewer.AwtText
All Implemented Interfaces:
Text

public class AwtText
extends java.lang.Object
implements Text


Constructor Summary
protected AwtText(java.lang.String propertyName, java.lang.String defaultFont)
           
 
Method Summary
 int charWidth(char c)
          Returns the width, in pixels, of the specified character.
static java.lang.String defaultFontFamily()
           
static int defaultFontSizeLarge()
           
static int defaultFontSizeMedium()
           
static int defaultFontSizeSmall()
           
 int getAscent()
          Returns the height, in pixels, of the distance from the baseline to top of the tallest character (including accents that are not common in english.
 java.awt.Font getAwtFont()
          Returns the Font from the AWT used for drawing within the AWT.
 int getDescent()
          Returns the height, in pixels, of the distance from bottom of the lowest descending character to the baseline.
 int getLineHeight()
          Returns the sum of the text height and line spacing.
 int getLineSpacing()
          Returns the number of blank vertical pixels to add between adjacent lines to give them additional spacing.
 int getMidPoint()
          Returns the mid point, in pixels, between the baseline and the top of the characters.
 java.lang.String getName()
          Return the name of this text style.
 int getTextHeight()
          Returns the height, in pixels, for a normal line of text - where there is some space between two lines of text.
 int stringHeight(java.lang.String text, int maxWidth)
          Returns the height in pixels when the specified text is wrapped at the specified width
 int stringWidth(java.lang.String text)
          Returns the width of the specified in pixels.
 int stringWidth(java.lang.String text, int maxWidth)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AwtText

protected AwtText(java.lang.String propertyName,
                  java.lang.String defaultFont)
Method Detail

charWidth

public int charWidth(char c)
Description copied from interface: Text
Returns the width, in pixels, of the specified character.

Specified by:
charWidth in interface Text

getAscent

public int getAscent()
Description copied from interface: Text
Returns the height, in pixels, of the distance from the baseline to top of the tallest character (including accents that are not common in english.

Specified by:
getAscent in interface Text

getAwtFont

public java.awt.Font getAwtFont()
Returns the Font from the AWT used for drawing within the AWT.

See Also:
Font

getDescent

public int getDescent()
Description copied from interface: Text
Returns the height, in pixels, of the distance from bottom of the lowest descending character to the baseline.

Specified by:
getDescent in interface Text

getLineHeight

public int getLineHeight()
Description copied from interface: Text
Returns the sum of the text height and line spacing.

Specified by:
getLineHeight in interface Text
See Also:
Text.getLineHeight(), Text.getLineSpacing()

getLineSpacing

public int getLineSpacing()
Description copied from interface: Text
Returns the number of blank vertical pixels to add between adjacent lines to give them additional spacing.

Specified by:
getLineSpacing in interface Text

getName

public java.lang.String getName()
Description copied from interface: Text
Return the name of this text style.

Specified by:
getName in interface Text

getMidPoint

public int getMidPoint()
Description copied from interface: Text
Returns the mid point, in pixels, between the baseline and the top of the characters.

Specified by:
getMidPoint in interface Text

getTextHeight

public int getTextHeight()
Description copied from interface: Text
Returns the height, in pixels, for a normal line of text - where there is some space between two lines of text.

Specified by:
getTextHeight in interface Text

stringHeight

public int stringHeight(java.lang.String text,
                        int maxWidth)
Description copied from interface: Text
Returns the height in pixels when the specified text is wrapped at the specified width

Specified by:
stringHeight in interface Text

stringWidth

public int stringWidth(java.lang.String text,
                       int maxWidth)
Specified by:
stringWidth in interface Text

stringWidth

public int stringWidth(java.lang.String text)
Description copied from interface: Text
Returns the width of the specified in pixels.

Specified by:
stringWidth in interface Text

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

defaultFontFamily

public static java.lang.String defaultFontFamily()

defaultFontSizeSmall

public static int defaultFontSizeSmall()

defaultFontSizeMedium

public static int defaultFontSizeMedium()

defaultFontSizeLarge

public static int defaultFontSizeLarge()


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.