Class Label


  • public class Label
    extends GraphShape
    A GraphUI text label GraphShape

    GraphUI is GPU based and resolution independent.

    • Constructor Detail

      • Label

        public Label​(int renderModes,
                     Font font,
                     float fontScale,
                     String text)
        Label ctor using a separate fontScale to scale the em-sized type glyphs
        Parameters:
        renderModes - region renderModes
        font - the font
        fontScale - font-scale factor, by which the em-sized type glyphs shall be scaled
        text - the text to render
      • Label

        public Label​(int renderModes,
                     Font font,
                     String text)
        Label ctor using em-size type glyphs
        Parameters:
        renderModes - region renderModes
        font - the font
        text - the text to render
    • Method Detail

      • getText

        public String getText()
        Return the text to be rendered.
      • setText

        public boolean setText​(GL2ES2 gl,
                               String text)
        Set the text to be rendered and immediately updates the shape if necessary.
        Parameters:
        gl - GL2ES2 to issue Shape.validate(GL2ES2) in case text changed to immediately update shape and Shape.getBounds()
        text - the text to be set.
        Returns:
        true if text has been updated, false if unchanged.
      • setText

        public boolean setText​(GLProfile glp,
                               String text)
        Set the text to be rendered and immediately updates the shape if necessary.
        Parameters:
        glp - GLProfile to issue Shape.validate(GLProfile) in case text changed to immediately update shape and Shape.getBounds()
        text - the text to be set.
        Returns:
        true if text has been updated, false if unchanged.
      • getFont

        public Font getFont()
        Return the Font used to render the text
      • setFont

        public boolean setFont​(Font font)
        Set the Font used to render the text
        Parameters:
        font - the font to be set.
        Returns:
        true if font has been updated, false if unchanged.
      • getFontScale

        public float getFontScale()
        Gets the font-scale factor, by which the em-sized type glyphs shall be scaled.
      • setFontScale

        public boolean setFontScale​(float fontScale)
        Sets the font-scale factor, by which the em-sized type glyphs shall be scaled.

        This will lead to a recreate the shape's region in case fontScale differs.

        Use Shape.scale(float, float, float) for non-expensive shape scaling.

        Parameters:
        fontScale - font-scale factor, by which the em-sized type glyphs shall be scaled
        Returns:
        true if font-scale has been updated, false if unchanged.