Class TextPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class TextPanel extends JPanel
The TextPanel renders text in a component. The text is surrounded by a border.
Version:
1.0
Author:
Wolfgang Christian
See Also:
  • Field Details

    • ZEROSIZE

      protected static Dimension ZEROSIZE
    • text

      protected String text
    • font

      protected Font font
    • fontname

      protected String fontname
    • fontsize

      protected int fontsize
    • fontstyle

      protected int fontstyle
    • textColor

      protected Color textColor
    • backgroundColor

      protected Color backgroundColor
    • dim

      protected Dimension dim
  • Constructor Details

    • TextPanel

      public TextPanel()
      Constructs a TextPanel and places it within the given drawing panel.
    • TextPanel

      public TextPanel(String text)
      Constructs a TextPanel and places it within the given drawing panel.
      Parameters:
      text - the text to be displayed
  • Method Details

    • setText

      public void setText(String _text)
      Sets the text. -- BH never called?? The position is ignored if the location is set to a corner.
      Parameters:
      _text -
    • setMessageFont

      public void setMessageFont(Font font)
      Sets the font. Added by Doug Brown Feb 2018
      Parameters:
      font - the font
    • getPreferredSize

      public Dimension getPreferredSize()
      Gets the preferred size of this component.
      Overrides:
      getPreferredSize in class JComponent
      Returns:
      a dimension object indicating this component's preferred size
      See Also:
    • paintComponent

      public void paintComponent(Graphics g)
      Paints this component.
      Overrides:
      paintComponent in class JComponent
      Parameters:
      g -