Class ImageNode

All Implemented Interfaces:
Iterable, Collection, List, GraphicsNode

public class ImageNode extends CompositeGraphicsNode
A graphics node that represents an image described as a graphics node.
  • Field Details

    • hitCheckChildren

      protected boolean hitCheckChildren
  • Constructor Details

    • ImageNode

      public ImageNode()
      Constructs a new empty ImageNode.
  • Method Details

    • setVisible

      public void setVisible(boolean isVisible)
      Description copied from class: CompositeGraphicsNode
      Sets if this node is visible or not depending on the specified value. Don't fire a graphicsNodeChange event because this doesn't really effect us (it effects our children through CSS inheritence).
      Specified by:
      setVisible in interface GraphicsNode
      Overrides:
      setVisible in class CompositeGraphicsNode
      Parameters:
      isVisible - If true this node is visible
    • getPrimitiveBounds

      public Rectangle2D getPrimitiveBounds()
      Description copied from class: CompositeGraphicsNode
      Returns the bounds of the area covered by this node's primitive paint.
      Specified by:
      getPrimitiveBounds in interface GraphicsNode
      Overrides:
      getPrimitiveBounds in class CompositeGraphicsNode
    • setHitCheckChildren

      public void setHitCheckChildren(boolean hitCheckChildren)
      If hitCheckChildren is true then nodeHitAt will return child nodes of this image. Otherwise it will only return this node (if the point is in the image).
    • getHitCheckChildren

      public boolean getHitCheckChildren()
    • paint

      public void paint(Graphics2D g2d)
      Paints this node.
      Specified by:
      paint in interface GraphicsNode
      Overrides:
      paint in class AbstractGraphicsNode
      Parameters:
      g2d - the Graphics2D to use
    • contains

      public boolean contains(Point2D p)
      Returns true if the specified Point2D is inside the boundary of this node, false otherwise.
      Specified by:
      contains in interface GraphicsNode
      Overrides:
      contains in class CompositeGraphicsNode
      Parameters:
      p - the specified Point2D in the user space
    • nodeHitAt

      public GraphicsNode nodeHitAt(Point2D p)
      Returns the GraphicsNode containing point p if this node or one of its children is sensitive to mouse events at p.
      Specified by:
      nodeHitAt in interface GraphicsNode
      Overrides:
      nodeHitAt in class CompositeGraphicsNode
      Parameters:
      p - the specified Point2D in the user space
    • setImage

      public void setImage(GraphicsNode newImage)
      Sets the graphics node that represents the image.
      Parameters:
      newImage - the new graphics node that represents the image
    • getImage

      public GraphicsNode getImage()
      Returns the graphics node that represents the image.