Package hec.gfx2d

Class G2dGraphicComponent

java.lang.Object
hec.gfx2d.G2dGraphicComponent

public class G2dGraphicComponent extends Object
Base class for graphic components displayed the Gfx2d Viewport. Graphic components have a rectangular region much like awt components which are sized and positioned within the viewport using a gridbag-like strategy.
  • Constructor Details

    • G2dGraphicComponent

      public G2dGraphicComponent()
      Default Constructor
    • G2dGraphicComponent

      public G2dGraphicComponent(G2dGraphicComponent g, G2dComponent c)
      Construct a graphic component with given parent and container
  • Method Details

    • setPosition

      public void setPosition(G2dGraphicPosition pos)
      Set the position object.
    • getPosition

      public G2dGraphicPosition getPosition()
      Get a reference to the position object
    • paint

      public void paint(Graphics g)
      Draws the component to the specified graphics context. If paint is overridden by a subclass, this method should be called by super.paint(g) to traverse the tree of child graphic components.
    • getPreferredSize

      public Dimension getPreferredSize()
      Returns the preferred size of this component. Should be overridden by sub-classes.
    • getPreferredSize

      public Dimension getPreferredSize(Graphics g)
      Returns the preferred size based on the current graphics display resolution
    • clear

      public void clear()
      Removes all child graphics.
    • setBounds

      public boolean setBounds(Graphics zd, LocalRect rc)
      Set the local coordinate bounds and resize all child objects accordingly.
    • getBounds

      public LocalRect getBounds()
      Returns the bounding rectangle in local coordinates.
    • sizeChildren

      public void sizeChildren()