All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.wizards.awt.FlowLabel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----com.sun.wizards.awt.FlowLabel

public class FlowLabel
extends Canvas
The FlowLabel is a simple text label that wraps text into its container. Line breaks always occur according to the line BreakIterator object. Simple html-style commands are interpreted to achieve bold and italics within the text.

Graphic of layout for four buttons

Here is the code for this applet:


 import java.applet.Applet;
 import java.awt.*;
 import com.sun.wizards.awt.*;
 public class Test extends Applet
 {
   public void init()
     {
       add(new FlowLabel("Flowlabel test:  < bold >This is an example" +
                         " of bold text< /bold >.  < italics >This is an" +
                         " example of italics text< /italics >."));
     }
 }
 

As the container is resized, the text will reflow to fit the container's new width.


Constructor Index

 o FlowLabel()
Constructs a new FlowLabel with no text.
 o FlowLabel(String)
Constructs a new FlowLabel with the specified text.

Method Index

 o getMinimumSize()
Gets the minimum size of this component.
 o getPreferredSize()
Gets the preferred size of this component.
 o paint(Graphics)
Paints the contents of the FlowLabel.
 o setHgap(int)
Sets the horizontal gap to the specified number of pixels.
 o setText(String)
Set the label text to the specified string.
 o setVgap(int)
Sets the vertical gap to the specified number of pixels.

Constructors

 o FlowLabel
 public FlowLabel()
Constructs a new FlowLabel with no text.

 o FlowLabel
 public FlowLabel(String text)
Constructs a new FlowLabel with the specified text.

Parameters:
text - The text for this label.

Methods

 o setHgap
 public void setHgap(int hgap)
Sets the horizontal gap to the specified number of pixels.

Parameters:
hgap - The horizontal gap.
 o setVgap
 public void setVgap(int vgap)
Sets the vertical gap to the specified number of pixels.

Parameters:
vgap - The vertical gap.
 o setText
 public void setText(String text)
Set the label text to the specified string.

Parameters:
text - The new text for this label.
 o getPreferredSize
 public Dimension getPreferredSize()
Gets the preferred size of this component.

Returns:
A dimension object indicating this component's preferred size.
Overrides:
getPreferredSize in class Component
 o getMinimumSize
 public Dimension getMinimumSize()
Gets the minimum size of this component.

Returns:
A dimension object indicating this component's minimum size.
Overrides:
getMinimumSize in class Component
 o paint
 public void paint(Graphics g)
Paints the contents of the FlowLabel.

Parameters:
g - The specified Graphics window.
Overrides:
paint in class Canvas

All Packages  Class Hierarchy  This Package  Previous  Next  Index