baseCode.graphics.text
Class Util

java.lang.Object
  extended bybaseCode.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
 

Constructor Detail

Util

public Util()
Method Detail

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 measured
font - the pixels width of a string varies from font to font
c - 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 compare
font - the pixels width of a string varies from font to font
c - 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 draw
text - the string to draw
font - the font to use
x - 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.