Class Ruler

    • Constructor Detail

      • Ruler

        public Ruler​(VectorCanvas canvas)
        Creates a new instance of Ruler with default value: HORIZONTAL and PX
        Parameters:
        canvas - VectorCanvas
      • Ruler

        public Ruler​(VectorCanvas canvas,
                     int orientation,
                     int unitType)
        Creates a new instance of Ruler
        Parameters:
        canvas - VectorCanvas
        orientation - HORIZONTAL or VERTICAL
        unitType - the unitType
    • Method Detail

      • updateIncrementAndUnits

        protected void updateIncrementAndUnits()
        update the increment and unit
      • setPreferredHeight

        public void setPreferredHeight​(int ph)
        Set Preferred Height
        Parameters:
        ph - Preferred Height
        See Also:
        setPreferredWidth(int)
      • setPreferredWidth

        public void setPreferredWidth​(int pw)
        Set Preferred Width
        Parameters:
        pw - Preferred Width
        See Also:
        setPreferredHeight(int)
      • repaintCaret

        protected final void repaintCaret()
      • setUnitType

        public void setUnitType​(int unitType)
        Set unitType for the ruler
        Parameters:
        unitType - PX,IN,CM,MM
        Throws:
        IllegalArgumentException - if unitType is not recognized
      • getUnitType

        public int getUnitType()
        Return the current unitType
        Returns:
        unitType