Class Anchor


  • public class Anchor
    extends Object
    Anchor of a graphical element. There exist only the three instances LEFT_BOTTOM, CENTER, and RIGHT_TOP.

    The anchor factor can be used in a position formular. Its value for the three instances reads:

    InstanceFactor
    LEFT_BOTTOM0
    CENTER1
    RIGHT_TOP2
    Author:
    Franz-Josef Elmer
    • Field Detail

      • LEFT_BOTTOM

        public static final Anchor LEFT_BOTTOM
        Anchor constant.
      • CENTER

        public static final Anchor CENTER
        Anchor constant.
      • RIGHT_TOP

        public static final Anchor RIGHT_TOP
        Anchor constant.
    • Method Detail

      • getHorizontalAnchor

        public static Anchor getHorizontalAnchor​(ConfigParameters config,
                                                 String key,
                                                 Anchor defaultValue)
        Returns form the specified configuration parameters the horizontal anchor defined by the specified key or the specified default value.
        Parameters:
        config - Configuration parameters.
        key - The key of the anchor. null is not allowed.
        defaultValue - The default value.
        Returns:
        one of the three instances of Anchor.
        Throws:
        FactoryException - if the value of key is neither left, center, nor right. Note, that FactoryException.getClassName() returns the invalid value.
      • getVerticalAnchor

        public static Anchor getVerticalAnchor​(ConfigParameters config,
                                               String key,
                                               Anchor defaultValue)
        Returns form the specified configuration parameters the vertical anchor defined by the specified key or the specified default value.
        Parameters:
        config - Configuration parameters.
        key - The key of the anchor. null is not allowed.
        defaultValue - The default value.
        Returns:
        one of the three instances of Anchor.
        Throws:
        FactoryException - if the value of key is neither top, center, nor bottom. Note, that FactoryException.getClassName() returns the invalid value.
      • getFactor

        public int getFactor()
        Returns the factor.