com.izforge.izpack.gui
Class LabelFactory

java.lang.Object
  extended by com.izforge.izpack.gui.LabelFactory
All Implemented Interfaces:
javax.swing.SwingConstants

public class LabelFactory
extends java.lang.Object
implements javax.swing.SwingConstants

A label factory which can handle modified look like to present icons or present it not.

Author:
Klaus Bartz

Nested Class Summary
static class LabelFactory.FullLineLabel
          This class is only needed to signal a different layout handling.
 
Field Summary
private static boolean useLabelIcons
           
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
LabelFactory()
           
 
Method Summary
static javax.swing.JLabel create(javax.swing.Icon image)
          Returns a new JLabel with the horizontal alignment CENTER.
static javax.swing.JLabel create(javax.swing.Icon image, int horizontalAlignment)
          Returns a new JLabel with the given horizontal alignment.
static javax.swing.JLabel create(java.lang.String text)
          Returns a new JLabel with the horizontal alignment CENTER.
static javax.swing.JLabel create(java.lang.String text, boolean isFullLine)
          Returns a new JLabel or FullLineLabel with the horizontal alignment CENTER.
static javax.swing.JLabel create(java.lang.String text, javax.swing.Icon image, int horizontalAlignment)
          Returns a new JLabel with the given horizontal alignment.
static javax.swing.JLabel create(java.lang.String text, javax.swing.Icon image, int horizontalAlignment, boolean isFullLine)
          Returns a new JLabel or FullLineLabel with the given horizontal alignment.
static javax.swing.JLabel create(java.lang.String text, int horizontalAlignment)
          Returns a new JLabel with the given horizontal alignment.
static javax.swing.JLabel create(java.lang.String text, int horizontalAlignment, boolean isFullLine)
          Returns a new JLabel or FullLineLabel with the given horizontal alignment.
static boolean isUseLabelIcons()
          Returns whether the factory creates labels with icons or without icons.
static void setUseLabelIcons(boolean b)
          Sets the use icon state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

useLabelIcons

private static boolean useLabelIcons
Constructor Detail

LabelFactory

public LabelFactory()
Method Detail

isUseLabelIcons

public static boolean isUseLabelIcons()
Returns whether the factory creates labels with icons or without icons.

Returns:
whether the factory creates labels with icons or without icons

setUseLabelIcons

public static void setUseLabelIcons(boolean b)
Sets the use icon state.

Parameters:
b - flag for the icon state

create

public static javax.swing.JLabel create(javax.swing.Icon image)
Returns a new JLabel with the horizontal alignment CENTER. If isUseLabelIcons is true, the given image will be set to the label, else an empty label returns.

Parameters:
image - the image to be used as label icon
Returns:
new JLabel with the given parameters

create

public static javax.swing.JLabel create(javax.swing.Icon image,
                                        int horizontalAlignment)
Returns a new JLabel with the given horizontal alignment. If isUseLabelIcons is true, the given image will be set to the label, else an empty label returns.

Parameters:
image - the image to be used as label icon
horizontalAlignment - horizontal alignment of the label
Returns:
new JLabel with the given parameters

create

public static javax.swing.JLabel create(java.lang.String text)
Returns a new JLabel with the horizontal alignment CENTER.

Parameters:
text - the text to be set
Returns:
new JLabel with the given parameters

create

public static javax.swing.JLabel create(java.lang.String text,
                                        boolean isFullLine)
Returns a new JLabel or FullLineLabel with the horizontal alignment CENTER.

Parameters:
text - the text to be set
isFullLine - determines whether a FullLineLabel or a JLabel should be created
Returns:
new JLabel or FullLineLabel with the given parameters

create

public static javax.swing.JLabel create(java.lang.String text,
                                        int horizontalAlignment)
Returns a new JLabel with the given horizontal alignment.

Parameters:
text - the text to be set
horizontalAlignment - horizontal alignment of the label
Returns:
new JLabel with the given parameters

create

public static javax.swing.JLabel create(java.lang.String text,
                                        int horizontalAlignment,
                                        boolean isFullLine)
Returns a new JLabel or FullLineLabel with the given horizontal alignment.

Parameters:
text - the text to be set
horizontalAlignment - horizontal alignment of the label
isFullLine - determines whether a FullLineLabel or a JLabel should be created
Returns:
new JLabel or FullLineLabel with the given parameters

create

public static javax.swing.JLabel create(java.lang.String text,
                                        javax.swing.Icon image,
                                        int horizontalAlignment)
Returns a new JLabel with the given horizontal alignment. If isUseLabelIcons is true, the given image will be set to the label. The given text will be set allways to the label. It is allowed, that image and/or text are null.

Parameters:
text - the text to be set
image - the image to be used as label icon
horizontalAlignment - horizontal alignment of the label
Returns:
new JLabel with the given parameters

create

public static javax.swing.JLabel create(java.lang.String text,
                                        javax.swing.Icon image,
                                        int horizontalAlignment,
                                        boolean isFullLine)
Returns a new JLabel or FullLineLabel with the given horizontal alignment. If isUseLabelIcons is true, the given image will be set to the label. The given text will be set allways to the label. It is allowed, that image and/or text are null.

Parameters:
text - the text to be set
image - the image to be used as label icon
horizontalAlignment - horizontal alignment of the label
isFullLine - determines whether a FullLineLabel or a JLabel should be created
Returns:
new JLabel or FullLineLabel with the given parameters