public class CanvasCharacter extends AbstractCoordinateShape
Represents a single character on the text canvas.
  • Constructor Details

    • CanvasCharacter

      public CanvasCharacter(Point3D centerLocation, char character, Color foregroundColor, Color backgroundColor)
      Creates a canvas character at the specified location with given colors.
      Parameters:
      centerLocation - the center position in 3D space
      character - the character to render
      foregroundColor - the foreground (text) color
      backgroundColor - the background color
  • Method Details

    • getFont

      public static Font getFont(int size)
      Returns a font of the specified size.

      If the font of the specified size is already cached, it will be returned. Otherwise, a new font will be created, cached and returned.

      Parameters:
      size - the size of the font
      Returns:
      the font
    • getBackgroundColor

      public Color getBackgroundColor()
      Returns the background color of the character.
      Returns:
      the background color
    • setBackgroundColor

      public void setBackgroundColor(Color backgroundColor)
      Sets the background color of the character.
      Parameters:
      backgroundColor - the new background color
    • getForegroundColor

      public Color getForegroundColor()
      Returns color of the foreground.
      Returns:
      the color
    • setForegroundColor

      public void setForegroundColor(Color foregroundColor)
      Sets color of the foreground.
      Parameters:
      foregroundColor - the color
    • paint

      public void paint(RenderingContext renderingContext)
      Paints the character on the screen.
      Specified by:
      paint in class AbstractCoordinateShape
      Parameters:
      renderingContext - the rendering context
    • setValue

      public void setValue(char value)
      Sets the character value to render.
      Parameters:
      value - the new character value