Class TextBoxFactory

java.lang.Object
games.stendhal.client.gui.j2d.TextBoxFactory

public class TextBoxFactory extends Object
A helper class for painting speech bubbles and other messages used on the screen.
  • Constructor Details

    • TextBoxFactory

      public TextBoxFactory()
      Create a new TextBoxFactory.
  • Method Details

    • createTextBox

      public Sprite createTextBox(String text, int width, Color textColor, Color fillColor, boolean isTalking)
      Creates a text box sprite.
      Parameters:
      text - the text inside the box
      width - maximum width of the text in the box in pixels
      textColor - color of the text
      fillColor - background color
      isTalking - true if the box should look like a chat bubble
      Returns:
      sprite of the text box
    • createFancyTextBox

      public Sprite createFancyTextBox(String text, Color textColor, int width, int leftMargin, int rightMargin, int topMargin, int bottomMargin, BackgroundPainter background)
      Create a text box with an image background.
      Parameters:
      text - the text inside the box
      textColor - base color of the text
      width - maximum width of the text in the box in pixels
      leftMargin - margin from the left side of the background image to the drawn text
      rightMargin - margin from the right side of the background image to the drawn text
      topMargin - margin from the top of the background image to the drawn text
      bottomMargin - margin from the bottom of the background image to the drawn text
      background - painter for the background
      Returns:
      text box sprite