All Packages Class Hierarchy This Package Previous Next Index
Class ch.swisslife.ibgm.mc2.MultiLineLabel
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----ch.swisslife.ibgm.mc2.MultiLineLabel
- public class MultiLineLabel
- extends Canvas
Component like label, but with multiple lines. Good for messages which span over more than one line.
Taken from "Java in a Nutshell" by David Flanagan, O'Reilly &Assoc.
-
alignment
-
-
CENTER
-
-
LEFT
-
-
line_ascent
-
-
line_height
-
-
line_widths
-
-
lines
-
-
margin_height
-
-
margin_width
-
-
max_width
-
-
num_lines
-
-
RIGHT
-
-
MultiLineLabel(String)
- Constructor version 4: nothing specified.
-
MultiLineLabel(String, int)
- Constructor version 3: alignment.
-
MultiLineLabel(String, int, int)
- Constructor version 2: margins.
-
MultiLineLabel(String, int, int, int)
- Constructor version 1: all options.
-
addNotify()
- Is used when our component is first called, but before it is displayed.
-
getAlignment()
-
-
getMarginHeight()
-
-
getMarginWidth()
-
-
getMinimumSize()
- If layout manager asks how big the minial space is
-
getPreferredSize()
- IF layout manager asks how big it should be, this is the answer.
-
measure()
- Gives back the size of the font, the width of each line.
-
newLabel(String)
-
-
paint(Graphics)
- Paints the Component.
-
setAlignment(int)
-
-
setFont(Font)
- Sets the Font
-
setLabel(String)
- Sets the label
-
setMarginHeight(int)
-
-
setMarginWidth(int)
-
LEFT
public static final int LEFT
CENTER
public static final int CENTER
RIGHT
public static final int RIGHT
lines
protected String lines[]
num_lines
protected int num_lines
margin_width
protected int margin_width
margin_height
protected int margin_height
line_height
protected int line_height
line_ascent
protected int line_ascent
line_widths
protected int line_widths[]
max_width
protected int max_width
alignment
protected int alignment
MultiLineLabel
public MultiLineLabel(String label,
int margin_width,
int margin_height,
int alignment)
- Constructor version 1: all options.
- Parameters:
- label - String with text
- margin_widht - int with margin width
- margin_height - int with height of margin
- alignment - int describing the alignment
MultiLineLabel
public MultiLineLabel(String label,
int width,
int height)
- Constructor version 2: margins.
- Parameters:
- label - String with text
- margin_widht - int with margin width
- margin_height - int with height of margin
MultiLineLabel
public MultiLineLabel(String label,
int alignment)
- Constructor version 3: alignment.
- Parameters:
- label - String with text
- alignment - int describing the alignment
MultiLineLabel
public MultiLineLabel(String label)
- Constructor version 4: nothing specified.
- Parameters:
- label - String with text
newLabel
protected void newLabel(String label)
measure
protected void measure()
- Gives back the size of the font, the width of each line.
setLabel
public void setLabel(String label)
- Sets the label
- Parameters:
- label - String with Text to be displayed
setFont
public void setFont(Font f)
- Sets the Font
- Parameters:
- f - Font
- Overrides:
- setFont in class Component
setAlignment
public void setAlignment(int a)
setMarginWidth
public void setMarginWidth(int mw)
setMarginHeight
public void setMarginHeight(int mh)
getAlignment
public int getAlignment()
getMarginWidth
public int getMarginWidth()
getMarginHeight
public int getMarginHeight()
addNotify
public void addNotify()
- Is used when our component is first called, but before it is displayed.
- Overrides:
- addNotify in class Canvas
getPreferredSize
public Dimension getPreferredSize()
- IF layout manager asks how big it should be, this is the answer.
- Returns:
- Dimension the size we need
- Overrides:
- getPreferredSize in class Component
getMinimumSize
public Dimension getMinimumSize()
- If layout manager asks how big the minial space is
- Returns:
- Dimension Minimal space
- Overrides:
- getMinimumSize in class Component
paint
public void paint(Graphics g)
- Paints the Component.
- Parameters:
- g - Graphics object of the component
- Overrides:
- paint in class Canvas
All Packages Class Hierarchy This Package Previous Next Index