Class Tick

  • All Implemented Interfaces:
    Serializable

    public class Tick
    extends Object
    implements Serializable
    Represents a single tick of an axis.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Position

        protected int m_Position
        the position.
      • m_Label

        protected String m_Label
        the label, if any.
      • m_Bounds

        protected Rectangle m_Bounds
        the computed rectangle for the text.
    • Constructor Detail

      • Tick

        public Tick​(int pos,
                    String label)
        Initializes the tick.
        Parameters:
        pos - the position of this tick
        label - the label for this tick, null to suppress
    • Method Detail

      • getPosition

        public int getPosition()
        Returns the tick's position.
        Returns:
        the position
      • hasLabel

        public boolean hasLabel()
        Returns whether this tick has a label or not.
        Returns:
        true if the tick has a label
      • getLabel

        public String getLabel()
        Returns the label of this tick, can be null.
        Returns:
        the label
      • setBounds

        public void setBounds​(int x,
                              int y,
                              int width,
                              int height)
        Sets the bounds for the text.
        Parameters:
        x - the x position
        y - the y position
        width - the width
        height - the height
      • hasBounds

        public boolean hasBounds()
        Returns whether bounds are stored with this tick.
        Returns:
        true if bounds are available
      • getBounds

        public Rectangle getBounds()
        Returns the bounds.
        Returns:
        the bounds, can be null if not available
      • toString

        public String toString()
        Returns a string representation of the tick.
        Overrides:
        toString in class Object
        Returns:
        a string representation