Class HintTextArea

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable

public class HintTextArea extends JTextArea
Simple text area that shows a text hint when the field is empty. Hint text will be shown in light grey, italicized, and in angle brackets. Normal text will be plain black.
See Also:
  • Constructor Details

    • HintTextArea

      public HintTextArea(String hint)
      Constructs the class with the hint text to be shown.
      Parameters:
      hint - the hint
  • Method Details

    • setText

      public void setText(String text)
      Need to override the setText method so we can set font attributes.
      Overrides:
      setText in class JTextComponent
      Parameters:
      text - the text
    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • setAttributes

      protected void setAttributes()
      Sets the text attributes to be used when NOT viewing the hint.