Package ubic.basecode.graphics.text
Class Util
java.lang.Object
ubic.basecode.graphics.text.Util
- Author:
- Will Braynen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
drawVerticalString
(Graphics g, String text, Font font, int x, int y) Draws a string vertically, turned 90 degrees counter-clockwise.static int
maxStringPixelWidth
(String[] strings, FontMetrics fm) static int
stringPixelWidth
(String text, FontMetrics fm)
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
drawVerticalString
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
- 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
strings
array.
-
stringPixelWidth
- 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.
-