Class MultiLineLabel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class MultiLineLabel extends JPanel
A label component that spans multiple lines. Given a text label containing embedded newline characters ('\n'), this component automatically breaks the text into individual lines.
See Also:
  • Constructor Details

    • MultiLineLabel

      public MultiLineLabel()
      Creates a new instance of a MultiLineLabel by breaking the given text into separate lines. All beans must have a zero-args constructor. A string value of " " will be used.
      See Also:
    • MultiLineLabel

      public MultiLineLabel(String str)
      Creates a new instance of a MultiLineLabel by breaking the given text into separate lines.
      Parameters:
      str - the multiline label
    • MultiLineLabel

      public MultiLineLabel(String str, int alignment)
      Creates a new instance of a MultiLineLabel by breaking the given text into separate lines.
      Parameters:
      str - the multiline label
      alignment - the text alignment (should be a SwingConstant)
    • MultiLineLabel

      public MultiLineLabel(String str, int maxPerLine, int alignment)
      Creates a new instance of a MultiLineLabel by breaking the given text into separate lines.
      Parameters:
      str - the multiline label
      maxPerLine - the maximum number of characters allowed on a line (-1 if you don't care)
      alignment - the text alignment (should be a SwingConstant)
  • Method Details

    • getNumLines

      public int getNumLines()
      Used to retrieve the number of lines of text contained in this component.
      Returns:
      the number of lines that comprise this component
    • breakUpLabel

      protected Vector breakUpLabel(String label)
    • setFont

      public void setFont(Font font)
      Overrides:
      setFont in class JComponent
    • getFont

      public Font getFont()
      Specified by:
      getFont in interface MenuContainer
      Overrides:
      getFont in class Component