Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Draw2d
3.3

org.eclipse.draw2d
Class TextUtilities

java.lang.Object
  extended by
org.eclipse.draw2d.TextUtilities

public class TextUtilities
extends java.lang.Object

Provides miscellaneous text operations. Clients may subclass this class if necessary.

Since:
3.4

Field Summary
static  TextUtilities INSTANCE
          a singleton default instance
 
Constructor Summary
TextUtilities ()
           
 
Method Summary
 int getAscent (Font font)
          Gets the font's ascent.
 int getDescent (Font font)
          Gets the font's descent.
 int getLargestSubstringConfinedTo (java.lang.String s, Font f, int availableWidth)
          Returns the largest substring of s in Font f that can be confined to the number of pixels in availableWidth.
  Dimension getStringExtents (java.lang.String s, Font f)
          Returns the Dimensions of s in Font f.
  Dimension getTextExtents (java.lang.String s, Font f)
          Returns the Dimensions of the given text, converting newlines and tabs appropriately.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static 
TextUtilities INSTANCE
a singleton default instance

Constructor Detail

TextUtilities

public TextUtilities()
Method Detail

getStringExtents

public 
Dimension getStringExtents(java.lang.String s,
                                  Font f)
Returns the Dimensions of s in Font f.

Parameters:
s - the string
f - the font
Returns:
the dimensions of the given string

getTextExtents

public 
Dimension getTextExtents(java.lang.String s,
                                Font f)
Returns the Dimensions of the given text, converting newlines and tabs appropriately.

Parameters:
s - the text
f - the font
Returns:
the dimensions of the given text

getAscent

public int getAscent(Font font)
Gets the font's ascent.

Parameters:
font -
Returns:
the font's ascent

getDescent

public int getDescent(Font font)
Gets the font's descent.

Parameters:
font -
Returns:
the font's descent

getLargestSubstringConfinedTo

public int getLargestSubstringConfinedTo(java.lang.String s,
                                         Font f,
                                         int availableWidth)
Returns the largest substring of s in Font f that can be confined to the number of pixels in availableWidth.

Parameters:
s - the original string
f - the font
availableWidth - the available width
Returns:
the largest substring that fits in the given width

Eclipse Draw2d
3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire