Class LabelUtils
java.lang.Object
VASSAL.tools.image.LabelUtils
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
drawHTMLLabel
(Graphics g, String text, int x, int y, Font f, int hAlign, int vAlign, Color fgColor, Color bgColor, Color borderColor, Component comp, int objectWidth, int textPad, int minWidth, int extraBorder) static void
drawHTMLLabel
(Graphics g, String text, int x, int y, Font f, int hAlign, int vAlign, Color fgColor, Color bgColor, Color borderColor, Component comp, int objectWidth, int textPad, int minWidth, int extraBorder, int extraTop, int extraBottom, boolean allowHTML) Draw an HTML-compliant text label with appropriate alignment and foreground/background color, plus a border box, and extra configuration parameters.static void
drawLabel
(Graphics g, String text, int x, int y, int hAlign, int vAlign, Color fgColor, Color bgColor) Draw a non-HTML text label with appropriate alignment and foreground/background colorstatic void
drawLabel
(Graphics g, String text, int x, int y, Font f, int hAlign, int vAlign, Color fgColor, Color bgColor, Color borderColor) Draw a non-HTML text label with appropriate alignment and foreground/background color, plus a border boxstatic void
drawLabel
(Graphics g, String text, int x, int y, Font f, int hAlign, int vAlign, Color fgColor, Color bgColor, Color borderColor, int objectWidth, int textPad, int minWidth, int extraBorder) Draw a non-HTML text label with appropriate alignment and foreground/background color, plus a border box, and extra configuration parametersstatic void
drawLabelBox
(Graphics2D g, Font font, String s, int imageWidth, int stringWidth, int height) static BufferedImage
labelBoxImage
(Font font, String s, int minWidth, int height) static int
labelWidth
(Font font, String s) static BufferedImage
Create a viewable representation of a null or empty image to use as a place holder in Configurers.static BufferedImage
noImageBoxImage
(int w, int h, double scale) Create a viewable representation of a null or empty image to use as a place holder in Configurers
-
Field Details
-
CENTER
public static final int CENTER- See Also:
-
RIGHT
public static final int RIGHT- See Also:
-
LEFT
public static final int LEFT- See Also:
-
TOP
public static final int TOP- See Also:
-
BOTTOM
public static final int BOTTOM- See Also:
-
-
Method Details
-
drawLabel
public static void drawLabel(Graphics g, String text, int x, int y, int hAlign, int vAlign, Color fgColor, Color bgColor) Draw a non-HTML text label with appropriate alignment and foreground/background color- Parameters:
g
- Graphics Objecttext
- text to drawx
- x locationy
- y locationhAlign
- Horizontal alignment (LEFT, RIGHT, or CENTER)vAlign
- Vertical alignment (TOP, BOTTOM, or CENTER)fgColor
- Foreground ColorbgColor
- Background Color
-
drawLabel
public static void drawLabel(Graphics g, String text, int x, int y, Font f, int hAlign, int vAlign, Color fgColor, Color bgColor, Color borderColor) Draw a non-HTML text label with appropriate alignment and foreground/background color, plus a border box- Parameters:
g
- Graphics Objecttext
- text to drawx
- x locationy
- y locationhAlign
- Horizontal alignment (LEFT, RIGHT, or CENTER)vAlign
- Vertical alignment (TOP, BOTTOM, or CENTER)fgColor
- Foreground ColorbgColor
- Background ColorborderColor
- Box color around border
-
drawLabel
public static void drawLabel(Graphics g, String text, int x, int y, Font f, int hAlign, int vAlign, Color fgColor, Color bgColor, Color borderColor, int objectWidth, int textPad, int minWidth, int extraBorder) Draw a non-HTML text label with appropriate alignment and foreground/background color, plus a border box, and extra configuration parameters- Parameters:
g
- Graphics Objecttext
- text to drawx
- x locationy
- y locationhAlign
- Horizontal alignment (LEFT, RIGHT, or CENTER)vAlign
- Vertical alignment (TOP, BOTTOM, or CENTER)fgColor
- Foreground ColorbgColor
- Background ColorborderColor
- Box color around borderobjectWidth
- 0 for default, or width of an optional "master object" inside of which the label is being drawn (allows better alignment options)textPad
- 0 for default, or extra padding around text in all 4 directionsminWidth
- 0 for default, or minimum width of text boxextraBorder
- 0 for default, or number of pixels of extra thickness of border box
-
drawHTMLLabel
-
drawHTMLLabel
public static void drawHTMLLabel(Graphics g, String text, int x, int y, Font f, int hAlign, int vAlign, Color fgColor, Color bgColor, Color borderColor, Component comp, int objectWidth, int textPad, int minWidth, int extraBorder, int extraTop, int extraBottom, boolean allowHTML) Draw an HTML-compliant text label with appropriate alignment and foreground/background color, plus a border box, and extra configuration parameters. Supports "Quick Colors".- Parameters:
g
- Graphics Objecttext
- text to drawx
- x locationy
- y locationhAlign
- Horizontal alignment (LEFT, RIGHT, or CENTER)vAlign
- Vertical alignment (TOP, BOTTOM, or CENTER)fgColor
- Foreground ColorbgColor
- Background ColorborderColor
- Box color around bordercomp
- Component we are drawing onobjectWidth
- 0 for default, or width of an optional "master object" inside of which the label is being drawn (allows better alignment options)textPad
- 0 for default, or extra padding around text in all 4 directionsminWidth
- 0 for default, or minimum width of text boxextraBorder
- 0 for default, or number of pixels of extra thickness of border box
-
labelWidth
-
drawLabelBox
public static void drawLabelBox(Graphics2D g, Font font, String s, int imageWidth, int stringWidth, int height) -
labelBoxImage
-
noImageBoxImage
Create a viewable representation of a null or empty image to use as a place holder in Configurers. * The image will contain the translated text for the key Editor.ImageUtils.no_image- Parameters:
w
- Minimum width for generated the imageh
- Height of the generated imagescale
- Scale factor for font- Returns:
- Viewable null image
-
noImageBoxImage
Create a viewable representation of a null or empty image to use as a place holder in Configurers. The image will contain the translated text for the key Editor.ImageUtils.no_image- Returns:
- Viewable null image
-