Class sunsoft.jws.visual.rt.awt.MultiLineLabel
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sunsoft.jws.visual.rt.awt.MultiLineLabel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----sunsoft.jws.visual.rt.awt.MultiLineLabel

public class MultiLineLabel
extends Canvas

Variable Index

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

Constructor Index

 o MultiLineLabel()
 o MultiLineLabel(String)
 o MultiLineLabel(String, int)
 o MultiLineLabel(String, int, int)
 o MultiLineLabel(String, int, int, int)
 o MultiLineLabel(String, int, int, int, int)
Break the label up into separate lines, and save the other info.

Method Index

 o addNotify()
This method is invoked after our Canvas is first created but before it can actually be displayed.
 o getAlignment()
 o getLabel()
 o getMarginHeight()
 o getMarginWidth()
 o measure()
This method figures out how the font is, and how wide each line of the label is, and how wide the widest line is.
 o minimumSize()
This method is called when the layout manager wants to know the bare minimum amount of space we need to get by.
 o newLabel(String)
This method breaks a specified label up into an array of lines.
 o paint(Graphics)
This method draws the label (applets use the same method).
 o preferredSize()
This method is called by a layout manager when it wants to know how big we'd like to be.
 o setAlignment(int)
 o setFont(Font)
 o setForeground(Color)
 o setLabel(String)
 o setMarginHeight(int)
 o setMarginWidth(int)

Variables

 o LEFT
  public final static int LEFT
 o CENTER
  public final static int CENTER
 o RIGHT
  public final static int RIGHT
 o label
  protected String label
 o lines
  protected Vector lines
 o num_lines
  protected int num_lines
 o maxChars
  protected int maxChars
 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 maxChars,
                        int margin_width,
                        int margin_height,
                        int alignment)
Break the label up into separate lines, and save the other info.
 o MultiLineLabel
  public MultiLineLabel(String label,
                        int maxChars,
                        int margin_width,
                        int margin_height)
 o MultiLineLabel
  public MultiLineLabel(String label,
                        int maxChars,
                        int alignment)
 o MultiLineLabel
  public MultiLineLabel(String label,
                        int maxChars)
 o MultiLineLabel
  public MultiLineLabel(String label)
 o MultiLineLabel
  public MultiLineLabel()

Methods

 o newLabel
  protected void newLabel(String label)
This method breaks a specified label up into an array of lines. It uses the StringTokenizer utility class.
 o measure
  protected void measure()
This method figures out how the font is, and how wide each line of the label is, and how wide the widest line is.
 o setLabel
  public void setLabel(String label)
 o getLabel
  public String getLabel()
 o setFont
  public void setFont(Font f)
Overrides:
setFont in class Component
 o setForeground
  public void setForeground(Color c)
Overrides:
setForeground 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()
This method is invoked after our Canvas is first created but before it can actually be displayed. After we've invoked our superclass's addNotify() method, we have font metrics and can successfully call measure() to figure out how big the label is.
Overrides:
addNotify in class Canvas
 o preferredSize
  public Dimension preferredSize()
This method is called by a layout manager when it wants to know how big we'd like to be.
Overrides:
preferredSize in class Component
 o minimumSize
  public Dimension minimumSize()
This method is called when the layout manager wants to know the bare minimum amount of space we need to get by.
Overrides:
minimumSize in class Component
 o paint
  public void paint(Graphics g)
This method draws the label (applets use the same method). Note that it handles the margins and the alignment, but that it doesn't have to worry about the color or font--the superclass takes care of setting those in the Graphics object we're passed.
Overrides:
paint in class Canvas

All Packages  Class Hierarchy  This Package  Previous  Next  Index