Package docking.util

Class TextShaper

java.lang.Object
docking.util.TextShaper

public class TextShaper extends Object
A class that will layout text into lines based on the given display size. This class requires the graphics context in order to correctly size the text.
  • Constructor Details

    • TextShaper

      public TextShaper(String text, Dimension displaySize, Graphics2D g2d)
      Creates a text shaper with the given text, display size and graphics context.
      Parameters:
      text - the text
      displaySize - the size
      g2d - the graphics
  • Method Details

    • getTextSize

      public Dimension getTextSize()
      Returns the bounds of the wrapped text of this class
      Returns:
      the bounds of the wrapped text of this class
    • isClipped

      public boolean isClipped()
      Returns true if the text is too large to fit in the original display size
      Returns:
      true if the text is too large to fit in the original display size
    • getLines

      public List<docking.util.TextShaper.TextShaperLine> getLines()
    • drawText

      public void drawText(Graphics2D g)
      Renders the wrapped text into the graphics used to create this class.
      Parameters:
      g - the graphics into which the text should be painted.