org.newdawn.slick.util
Class FontUtils

java.lang.Object
  extended by org.newdawn.slick.util.FontUtils

public class FontUtils
extends java.lang.Object

Simple utility class to support justified text http://slick.javaunlimited.net/viewtopic.php?t=2640

Author:
zenzei

Nested Class Summary
 class FontUtils.Alignment
          Alignment indicators
 
Constructor Summary
FontUtils()
           
 
Method Summary
static void drawCenter(Font font, java.lang.String s, int x, int y, int width)
          Draw text center justified
static void drawCenter(Font font, java.lang.String s, int x, int y, int width, Color color)
          Draw text center justified
static void drawLeft(Font font, java.lang.String s, int x, int y)
          Draw text left justified
static void drawRight(Font font, java.lang.String s, int x, int y, int width)
          Draw text right justified
static void drawRight(Font font, java.lang.String s, int x, int y, int width, Color color)
          Draw text right justified
static int drawString(Font font, java.lang.String s, int alignment, int x, int y, int width, Color color)
          Draw a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontUtils

public FontUtils()
Method Detail

drawLeft

public static void drawLeft(Font font,
                            java.lang.String s,
                            int x,
                            int y)
Draw text left justified

Parameters:
font - The font to draw with
s - The string to draw
x - The x location to draw at
y - The y location to draw at

drawCenter

public static void drawCenter(Font font,
                              java.lang.String s,
                              int x,
                              int y,
                              int width)
Draw text center justified

Parameters:
font - The font to draw with
s - The string to draw
x - The x location to draw at
y - The y location to draw at
width - The width to fill with the text

drawCenter

public static void drawCenter(Font font,
                              java.lang.String s,
                              int x,
                              int y,
                              int width,
                              Color color)
Draw text center justified

Parameters:
font - The font to draw with
s - The string to draw
x - The x location to draw at
y - The y location to draw at
width - The width to fill with the text
color - The color to draw in

drawRight

public static void drawRight(Font font,
                             java.lang.String s,
                             int x,
                             int y,
                             int width)
Draw text right justified

Parameters:
font - The font to draw with
s - The string to draw
x - The x location to draw at
y - The y location to draw at
width - The width to fill with the text

drawRight

public static void drawRight(Font font,
                             java.lang.String s,
                             int x,
                             int y,
                             int width,
                             Color color)
Draw text right justified

Parameters:
font - The font to draw with
s - The string to draw
x - The x location to draw at
y - The y location to draw at
width - The width to fill with the text
color - The color to draw in

drawString

public static final int drawString(Font font,
                                   java.lang.String s,
                                   int alignment,
                                   int x,
                                   int y,
                                   int width,
                                   Color color)
Draw a string

Parameters:
font - The font to draw with
s - The text to draw
alignment - The alignment to apply
x - The x location to draw at
y - The y location to draw at
width - The width to fill with the string
color - The color to draw in
Returns:
The final x coordinate of the text


Copyright © 2006 New Dawn Software. All Rights Reserved.