Package anlavn.ui

Class ChatBox

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

public class ChatBox extends JScrollPane
The ChatBox class supports display a message box like messenger.
See Also:
  • Constructor Details

    • ChatBox

      public ChatBox()
      Create a default message box. To customize the look, refer to the methods below.
      See Also:





  • Method Details

    • addRightBubble

      public void addRightBubble(String message)
      Use this method to add a bubble text at right side message box.
      Parameters:
      message - is a message you want to add.
    • addLeftBubble

      public void addLeftBubble(String message)
      Use this method to add a bubble text at left side message box.
      Parameters:
      message - is a message you want to add.
    • addNotifiBox

      public void addNotifiBox(String message)
      Use this method to add a notification in message box.
      Parameters:
      message - is a notification you want to add.
    • setFontSize

      public void setFontSize(Font font)
      Use this method to customize font size of message.
      Parameters:
      font - is your desired font.
    • setBorderRadius

      public void setBorderRadius(int BorderRadius)
      Use this method to customize border radius of bubble message.
      Parameters:
      BorderRadius - is your desired border radius.
    • setNotifiColor

      public void setNotifiColor(Color NotifiColor)
      Use this method to customize the color of notification message.
      Parameters:
      NotifiColor - is your desired color.
    • setRightBubble

      public void setRightBubble(Color StartColor, Color EndColor, int GradientFocus)
      Use this method to customize the bubble at the right side of the message box
      Parameters:
      StartColor - is gradient end color to the left.
      EndColor - is gradient end color to the right.
      GradientFocus - is location to which the gradient should focus (accepts negative value)
    • setLeftBubble

      public void setLeftBubble(Color StartColor, Color EndColor, int GradientFocus)
      Use this method to customize the bubble at the left side of the message box
      Parameters:
      StartColor - is gradient end color to the left.
      EndColor - is gradient end color to the right.
      GradientFocus - is location to which the gradient should focus (accepts negative value)
    • paintComponent

      protected void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • setLayout

      public void setLayout(LayoutManager mgr)
      Overrides:
      setLayout in class JScrollPane