Package ubic.basecode.graphics.text
Class Util
- java.lang.Object
-
- ubic.basecode.graphics.text.Util
-
public class Util extends Object
- Author:
- Will Braynen
-
-
Constructor Summary
Constructors Constructor Description Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddrawVerticalString(Graphics g, String text, Font font, int x, int y)Draws a string vertically, turned 90 degrees counter-clockwise.static intmaxStringPixelWidth(String[] strings, FontMetrics fm)static intstringPixelWidth(String text, FontMetrics fm)
-
-
-
Method Detail
-
drawVerticalString
public static void drawVerticalString(Graphics g, String text, 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.
-
maxStringPixelWidth
public static int maxStringPixelWidth(String[] strings, FontMetrics fm)
- Parameters:
strings- an array of strings whose pixels widths to comparefm- FontMetrics object for the Component or Graphics.- Returns:
- the largest pixel width of a string in the
stringsarray.
-
stringPixelWidth
public static int stringPixelWidth(String text, FontMetrics fm)
- Parameters:
text- the string whose pixel width is to be measuredfm- FontMetrics object for the Component or Graphics.- Returns:
- the pixel width of the string for the specified font.
-
-