Class ChatBubble

All Implemented Interfaces:
Animation, Editable, StyleListener, Iterable<Component>

public class ChatBubble extends Container

One row in a ChatView. Renders a ChatMessage as a styled container holding a TextArea for the body text. Defaults the UIID based on the message Role: ChatBubbleUser, ChatBubbleAssistant, ChatBubbleSystem.

The body TextArea is non-editable and uses native scrolling behaviour off; it wraps within the bubble. Apps that want richer rendering (markdown, code blocks) can subclass and override renderBody() without rewriting the wrapper.

  • Constructor Details

  • Method Details

    • setText

      public void setText(String text)
      Replace the bubble's body text and re-render. Safe to call from any thread; the actual mutation is marshalled to the EDT.
    • appendText

      public void appendText(String delta)
      Append a token-sized delta to the bubble's body. Used by ChatView.appendToLastMessage(String) during LLM streaming.
    • getMessage

      public ChatMessage getMessage()
    • getBubbleText

      public String getBubbleText()
    • getBody

      protected TextArea getBody()
      Returns the inner TextArea for styling tweaks beyond the UIID hooks (e.g. setting a custom font).
    • renderBody

      protected void renderBody()
      Subclass hook for custom rendering of the body. Default behaviour is to keep the inner TextArea in sync with whatever text has been set; override to swap in a different child component.