Class SwingMessageField<M extends Message>

All Implemented Interfaces:
MessageReceiver<M>, ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants

public class SwingMessageField<M extends Message> extends JLabel implements MessageReceiver<M>
A one-line display for messages to be included in a Swing based GUI. The background color is set according to the Message.Kind.
See Also:
  • Field Details

  • Constructor Details

    • SwingMessageField

      public SwingMessageField()
  • Method Details

    • setColorWarn

      public Color setColorWarn(Color nc)
      Evident
    • setColorError

      public Color setColorError(Color nc)
      Evident
    • setColorHint

      public Color setColorHint(Color nc)
      Evident
    • setColorNeutral

      public Color setColorNeutral(Color nc)
      Evident
    • setMessageToString

      public void setMessageToString(Function<? super M,String> toStr)
      Sets the function which is applied to the received message for getting a printable String.
    • setLocallyUsed

      public void setLocallyUsed(boolean locallyUsed)
      Allows a local use of the label and prevents overwriting by incoming messages.
    • receive

      public void receive(M msg)
      Receive a message, render it to string and print it on the message field. That can be suppressed by locallyUsed. The background color is swichted according to Message.Kind.
      Specified by:
      receive in interface MessageReceiver<M extends Message>
    • clear

      public void clear()
      Set background color to neutral and text content to empty.