baseCode.graphics.text
Class Util
java.lang.Object
baseCode.graphics.text.Util
- public class Util
- extends java.lang.Object
- Version:
- $Id: Util.java,v 1.9 2004/07/27 03:18:58 pavlidis Exp $
- Author:
- Will Braynen
|
Constructor Summary |
Util()
|
|
Method Summary |
static void |
drawVerticalString(java.awt.Graphics g,
java.lang.String text,
java.awt.Font font,
int x,
int y)
Draws a string vertically, turned 90 degrees counter-clockwise. |
static int |
maxStringPixelWidth(java.lang.String[] strings,
java.awt.Font font,
java.awt.Component c)
|
static int |
stringPixelWidth(java.lang.String text,
java.awt.Font font,
java.awt.Component c)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Util
public Util()
stringPixelWidth
public static int stringPixelWidth(java.lang.String text,
java.awt.Font font,
java.awt.Component c)
- Parameters:
text - the string whose pixel width is to be measuredfont - the pixels width of a string varies from font to fontc - the parent component; usually this
- Returns:
- the pixel width of the string for the specified font.
maxStringPixelWidth
public static int maxStringPixelWidth(java.lang.String[] strings,
java.awt.Font font,
java.awt.Component c)
- Parameters:
strings - an array of strings whose pixels widths to comparefont - the pixels width of a string varies from font to fontc - the parent component; usually this
- Returns:
- the largest pixel width of a string in the
strings array.
drawVerticalString
public static void drawVerticalString(java.awt.Graphics g,
java.lang.String text,
java.awt.Font font,
int x,
int y)
- Draws a string vertically, turned 90 degrees counter-clockwise. Read carefully what the x and y
coordinates means; chances are that if you draw to (x,y) = (0,0), you won't see anything.
- Parameters:
g - the graphics context on which to drawtext - the string to drawfont - the font to usex - the x coordinate where you want to place the baseline of the text.y - the y coordinate where you want to place the first letter of the text.
Copyright © 2003-2005 Columbia University. All Rights Reserved.