Class G2TextMeasurer

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.awt.Graphics2D g2
      The graphics device.
    • Constructor Summary

      Constructors 
      Constructor Description
      G2TextMeasurer​(java.awt.Graphics2D g2)
      Creates a new text measurer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float getStringWidth​(java.lang.String text, int start, int end)
      Returns the string width.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • g2

        private java.awt.Graphics2D g2
        The graphics device.
    • Constructor Detail

      • G2TextMeasurer

        public G2TextMeasurer​(java.awt.Graphics2D g2)
        Creates a new text measurer.
        Parameters:
        g2 - the graphics device.
    • Method Detail

      • getStringWidth

        public float getStringWidth​(java.lang.String text,
                                    int start,
                                    int end)
        Returns the string width.
        Specified by:
        getStringWidth in interface TextMeasurer
        Parameters:
        text - the text.
        start - the index of the first character to measure.
        end - the index of the last character to measure.
        Returns:
        The string width.