@Override public Figure findFigureInside(Point2D.Double p) { if (getDrawingArea().contains(p)) { Figure found = null; for (Figure child : getChildrenFrontToBack()) { if (child.isVisible()) { found = child.findFigureInside(p); if (found != null) { return found; } } } } return null; } // CONNECTING
@Override public boolean contains(Point2D.Double p) { if (getDrawingArea().contains(p)) { for (Figure child : getChildrenFrontToBack()) { if (child.isVisible() && child.contains(p)) return true; } return super.contains(p); } return false; } // ATTRIBUTES
@Override public Rectangle2D.Double getDrawingArea() { if (cachedDrawingArea == null) { cachedDrawingArea = super.getDrawingArea(); for (Figure child : getChildrenFrontToBack()) { if (child.isVisible()) { Rectangle2D.Double childBounds = child.getDrawingArea(); if (! childBounds.isEmpty()) { cachedDrawingArea.add(childBounds); } } } } return (Rectangle2D.Double) cachedDrawingArea.clone(); } @Override