private void rebound() { for (Component c : layers.getComponents()) { c.setBounds(layers.getBounds()); } this.updateUI(); }
/** * Gets the higest visible component in a ancestor hierarchy at * specific x,y coordinates */ private static Object getDeepestObjectAt(Object parent, int x, int y) { if (parent instanceof Container) { Container cont = (Container)parent; // use a copy of 1.3 Container.findComponentAt Component child = findComponentAt(cont, cont.getWidth(), cont.getHeight(), x, y); if (child != null && child != cont) { if (child instanceof JRootPane) { JLayeredPane lp = ((JRootPane)child).getLayeredPane(); Rectangle b = lp.getBounds(); child = (Component)getDeepestObjectAt(lp, x - b.x, y - b.y); } if (child != null) { return child; } } } // if the parent is not a Container then it might be a MenuItem. // But even if it isn't a MenuItem just return the parent because // that's a close as we can come. return parent; }
public static Object getDeepestObjectAt(Object parent, int x, int y) { if (parent != null && parent instanceof Container) { // use a copy of 1.3 Container.findComponentAt Component child = findComponentAt((Container) parent, x, y); if (child != null && child != parent) { if (child instanceof JRootPane) { JLayeredPane lp = ((JRootPane) child).getLayeredPane(); Rectangle b = lp.getBounds(); child = (Component) getDeepestObjectAt(lp, x - b.x, y - b.y); if (child != null) { return child; } } else { return child; } } } // if the parent is not a Container then it might be a MenuItem. // But even if it isn't a MenuItem just return the parent because // that's a close as we can come. return parent; }
/** * Gets the higest visible component in a ancestor hierarchy at * specific x,y coordinates * @param parent * @param x * @param y * @return */ public static Component getDeepestObjectAt(Component parent, int x, int y) { if (parent instanceof Container) { Container cont = (Container) parent; // use a copy of 1.3 Container.findComponentAt Component child = findComponentAt(cont, cont.getWidth(), cont.getHeight(), x, y); if (child != null && child != cont) { //log.info("child find : " + child.getName()); if (child instanceof JRootPane) { JLayeredPane lp = ((JRootPane) child).getLayeredPane(); Rectangle b = lp.getBounds(); child = getDeepestObjectAt(lp, x - b.x, y - b.y); } if (child != null) { return child; } } } // if the parent is not a Container then it might be a MenuItem. // But even if it isn't a MenuItem just return the parent because // that's a close as we can come. return parent; }
Rectangle b = lp.getBounds(); child = getDeepestObjectAt(lp, x - b.x, y - b.y);
Rectangle b = lp.getBounds(); child = getDeepestObjectAt(lp, x - b.x, y - b.y);