Interface Segment

  • All Known Implementing Classes:
    AbstractSegment, TextSegment

    public interface Segment
    One segment of a Line which should be displayed without changing text attributes.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void draw​(@NotNull java.awt.Graphics g, int y, @NotNull Fonts fonts)
      Draws this segment to a Graphics instance.
      @NotNull java.awt.geom.RectangularShape getSize​(@NotNull Fonts fonts, @NotNull java.awt.font.FontRenderContext context)
      Returns the size of this segment in pixels.
      void setWidth​(int width)
      Sets the width to display the segment.
      void setX​(int x)
      Sets the x-coordinate to display the segment.
      void setY​(int y)
      Sets the y-coordinate to display the segment.
      void updateAttributes​(@NotNull Fonts fonts, @NotNull java.awt.font.FontRenderContext context)
      Updates the cached attributes of this segment.
    • Method Detail

      • setX

        void setX​(int x)
        Sets the x-coordinate to display the segment.
        Parameters:
        x - the x-coordinate
      • setY

        void setY​(int y)
        Sets the y-coordinate to display the segment.
        Parameters:
        y - the y-coordinate
      • setWidth

        void setWidth​(int width)
        Sets the width to display the segment.
        Parameters:
        width - the width
      • draw

        void draw​(@NotNull
                  @NotNull java.awt.Graphics g,
                  int y,
                  @NotNull
                  @NotNull Fonts fonts)
        Draws this segment to a Graphics instance.
        Parameters:
        g - the graphics to draw to
        y - the y-coordinate to draw to
        fonts - the fonts to use
      • updateAttributes

        void updateAttributes​(@NotNull
                              @NotNull Fonts fonts,
                              @NotNull
                              @NotNull java.awt.font.FontRenderContext context)
        Updates the cached attributes of this segment.
        Parameters:
        fonts - the fonts instance to use
        context - the font render context to use
      • getSize

        @NotNull
        @NotNull java.awt.geom.RectangularShape getSize​(@NotNull
                                                        @NotNull Fonts fonts,
                                                        @NotNull
                                                        @NotNull java.awt.font.FontRenderContext context)
        Returns the size of this segment in pixels.
        Parameters:
        fonts - the fonts instance to use
        context - the font render context to use
        Returns:
        the size