Class TextOverlayLayerUI

All Implemented Interfaces:
Serializable

public class TextOverlayLayerUI extends LayerUI<JComponent>
A LayerUI that display a centered text over the view component using a semi-transparent background.
See Also:
  • Constructor Details

    • TextOverlayLayerUI

      public TextOverlayLayerUI()
      Create the overlay in invisible state (text is null).
    • TextOverlayLayerUI

      public TextOverlayLayerUI(String text)
      Create the overlay with the specified text.
  • Method Details

    • setText

      public final void setText(String text)
      The text to be displayed on a semi-transparent background over the view component.

      NOTE: caller should call repaint() after having called setText().

      Parameters:
      text - If null nothing is shown (overlay is invisible). If text contains '\n', text is shown a multiple lines.
    • getText

      public String getText()
      The displayed text.
      Returns:
      If null it means the overlay is invisible.
    • paint

      public void paint(Graphics g, JComponent jc)
      Overrides:
      paint in class LayerUI<JComponent>