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.


Variable Index

 o alignment
 o CENTER
 o LEFT
 o line_ascent
 o line_height
 o line_widths
 o lines
 o margin_height
 o margin_width
 o max_width
 o num_lines
 o RIGHT

Constructor Index

 o MultiLineLabel(String)
Constructor version 4: nothing specified.
 o MultiLineLabel(String, int)
Constructor version 3: alignment.
 o MultiLineLabel(String, int, int)
Constructor version 2: margins.
 o MultiLineLabel(String, int, int, int)
Constructor version 1: all options.

Method Index

 o addNotify()
Is used when our component is first called, but before it is displayed.
 o getAlignment()
 o getMarginHeight()
 o getMarginWidth()
 o getMinimumSize()
If layout manager asks how big the minial space is
 o getPreferredSize()
IF layout manager asks how big it should be, this is the answer.
 o measure()
Gives back the size of the font, the width of each line.
 o newLabel(String)
 o paint(Graphics)
Paints the Component.
 o setAlignment(int)
 o setFont(Font)
Sets the Font
 o setLabel(String)
Sets the label
 o setMarginHeight(int)
 o setMarginWidth(int)

Variables

 o LEFT
 public static final int LEFT
 o CENTER
 public static final int CENTER
 o RIGHT
 public static final int RIGHT
 o lines
 protected String lines[]
 o num_lines
 protected int num_lines
 o margin_width
 protected int margin_width
 o margin_height
 protected int margin_height
 o line_height
 protected int line_height
 o line_ascent
 protected int line_ascent
 o line_widths
 protected int line_widths[]
 o max_width
 protected int max_width
 o alignment
 protected int alignment

Constructors

 o 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
 o 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
 o MultiLineLabel
 public MultiLineLabel(String label,
                       int alignment)
Constructor version 3: alignment.

Parameters:
label - String with text
alignment - int describing the alignment
 o MultiLineLabel
 public MultiLineLabel(String label)
Constructor version 4: nothing specified.

Parameters:
label - String with text

Methods

 o newLabel
 protected void newLabel(String label)
 o measure
 protected void measure()
Gives back the size of the font, the width of each line.

 o setLabel
 public void setLabel(String label)
Sets the label

Parameters:
label - String with Text to be displayed
 o setFont
 public void setFont(Font f)
Sets the Font

Parameters:
f - Font
Overrides:
setFont in class Component
 o setAlignment
 public void setAlignment(int a)
 o setMarginWidth
 public void setMarginWidth(int mw)
 o setMarginHeight
 public void setMarginHeight(int mh)
 o getAlignment
 public int getAlignment()
 o getMarginWidth
 public int getMarginWidth()
 o getMarginHeight
 public int getMarginHeight()
 o addNotify
 public void addNotify()
Is used when our component is first called, but before it is displayed.

Overrides:
addNotify in class Canvas
 o 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
 o getMinimumSize
 public Dimension getMinimumSize()
If layout manager asks how big the minial space is

Returns:
Dimension Minimal space
Overrides:
getMinimumSize in class Component
 o 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