Package pdf

Class BoundingBox

  • All Implemented Interfaces:
    java.awt.Shape, java.io.Serializable, java.lang.Cloneable

    public class BoundingBox
    extends java.awt.Rectangle
    This class represents a bounding box. It holds coordinate information and properties used for graphical operations.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D

        java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int HORIZ_ALIGN_CENTER
      Used to align a String horizontally in the center of the box
      static int HORIZ_ALIGN_LEFT
      Used to align a String to the left in the box
      static int HORIZ_ALIGN_RIGHT
      Used to aling a String to the right in a box
      static int LINE_SPACING_PERCENTAGE
      Percent f line height to space lines
      static int SUBTRACT_FROM_BOTTOM
      Used to subtract a child from a box, *leaving* the bottom portion
      static int SUBTRACT_FROM_LEFT
      Used to subtract a child from a box, *leaving* the left portion
      static int SUBTRACT_FROM_RIGHT
      Used to subtract a child from a box, *leaving" the right portion
      static int SUBTRACT_FROM_TOP
      Used to subtract a child from a box, *leaving* the top portion
      static int VERT_ALIGN_BOTTOM
      Used to align a String at the bottom of the box
      static int VERT_ALIGN_CENTER
      Used to a align a String centered vertically
      static int VERT_ALIGN_TOP
      Used to align a String at the top of the box
      • Fields inherited from class java.awt.Rectangle

        height, width, x, y
      • Fields inherited from class java.awt.geom.Rectangle2D

        OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
    • Constructor Summary

      Constructors 
      Constructor Description
      BoundingBox()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(BoundingBox child)
      Make the specified box this box's child.
      java.awt.Point getAbsoluteLocation()
      Get the absolute upper left location point for this box
      BoundingBox getParent()
      Get this box's parent box
      boolean hasParent()
      Returns true if this box has a parent.
      void setParent​(BoundingBox parent)
      Make the specified box this box's parent
      • Methods inherited from class java.awt.Rectangle

        add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, toString, translate, union
      • Methods inherited from class java.awt.geom.Rectangle2D

        add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
      • Methods inherited from class java.awt.geom.RectangularShape

        clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.awt.Shape

        contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
    • Field Detail

      • LINE_SPACING_PERCENTAGE

        public static final int LINE_SPACING_PERCENTAGE
        Percent f line height to space lines
        See Also:
        Constant Field Values
      • VERT_ALIGN_CENTER

        public static final int VERT_ALIGN_CENTER
        Used to a align a String centered vertically
        See Also:
        Constant Field Values
      • VERT_ALIGN_TOP

        public static final int VERT_ALIGN_TOP
        Used to align a String at the top of the box
        See Also:
        Constant Field Values
      • VERT_ALIGN_BOTTOM

        public static final int VERT_ALIGN_BOTTOM
        Used to align a String at the bottom of the box
        See Also:
        Constant Field Values
      • HORIZ_ALIGN_CENTER

        public static final int HORIZ_ALIGN_CENTER
        Used to align a String horizontally in the center of the box
        See Also:
        Constant Field Values
      • HORIZ_ALIGN_LEFT

        public static final int HORIZ_ALIGN_LEFT
        Used to align a String to the left in the box
        See Also:
        Constant Field Values
      • HORIZ_ALIGN_RIGHT

        public static final int HORIZ_ALIGN_RIGHT
        Used to aling a String to the right in a box
        See Also:
        Constant Field Values
      • SUBTRACT_FROM_TOP

        public static final int SUBTRACT_FROM_TOP
        Used to subtract a child from a box, *leaving* the top portion
        See Also:
        Constant Field Values
      • SUBTRACT_FROM_BOTTOM

        public static final int SUBTRACT_FROM_BOTTOM
        Used to subtract a child from a box, *leaving* the bottom portion
        See Also:
        Constant Field Values
      • SUBTRACT_FROM_LEFT

        public static final int SUBTRACT_FROM_LEFT
        Used to subtract a child from a box, *leaving* the left portion
        See Also:
        Constant Field Values
      • SUBTRACT_FROM_RIGHT

        public static final int SUBTRACT_FROM_RIGHT
        Used to subtract a child from a box, *leaving" the right portion
        See Also:
        Constant Field Values
    • Constructor Detail

      • BoundingBox

        public BoundingBox()
    • Method Detail

      • hasParent

        public boolean hasParent()

        Returns true if this box has a parent. The 'world', or enclosing canvas is not considered a parent

        Returns:
        a boolean value
      • getParent

        public BoundingBox getParent()

        Get this box's parent box

        Returns:
        a BoundingBox value
      • add

        public void add​(BoundingBox child)

        Make the specified box this box's child. Equivalent to child.setParent(parent) where the specified 'parent' is this instance

        Parameters:
        child - a BoundingBox, any box that can fit inside this one. The results of calling getAbsoluteLocation() on the child will be altered after this to take into account the child's new location in the 'world'
      • setParent

        public void setParent​(BoundingBox parent)

        Make the specified box this box's parent

        Parameters:
        parent - a BoundingBox value
      • getAbsoluteLocation

        public java.awt.Point getAbsoluteLocation()

        Get the absolute upper left location point for this box

        Returns:
        a Point value