/** * @param x in editor pane coordinates * @param y in editor pane coordinates */ public static RadComponent getRadComponentAt(final RadRootContainer rootContainer, final int x, final int y) { Point location = new Point(x, y); SwingUtilities.convertPointToScreen(location, rootContainer.getDelegee()); Component c = getDeepestEmptyComponentAt(rootContainer.getDelegee(), location); if (c == null) { c = SwingUtilities.getDeepestComponentAt(rootContainer.getDelegee(), x, y); } RadComponent result = null; while (c != null) { if (c instanceof JComponent) { final RadComponent component = (RadComponent)((JComponent)c).getClientProperty(RadComponent.CLIENT_PROP_RAD_COMPONENT); if (component != null) { if (result == null) { result = component; } else { final Point p = SwingUtilities.convertPoint(rootContainer.getDelegee(), x, y, c); if (Painter.getResizeMask(component, p.x, p.y) != 0) { result = component; } } } } c = c.getParent(); } return result; }
/** * @param x in editor pane coordinates * @param y in editor pane coordinates */ public static RadComponent getRadComponentAt(final RadRootContainer rootContainer, final int x, final int y) { Point location = new Point(x, y); SwingUtilities.convertPointToScreen(location, rootContainer.getDelegee()); Component c = getDeepestEmptyComponentAt(rootContainer.getDelegee(), location); if(c == null) { c = SwingUtilities.getDeepestComponentAt(rootContainer.getDelegee(), x, y); } RadComponent result = null; while(c != null) { if(c instanceof JComponent) { final RadComponent component = (RadComponent) ((JComponent) c).getClientProperty(RadComponent.CLIENT_PROP_RAD_COMPONENT); if(component != null) { if(result == null) { result = component; } else { final Point p = SwingUtilities.convertPoint(rootContainer.getDelegee(), x, y, c); if(Painter.getResizeMask(component, p.x, p.y) != 0) { result = component; } } } } c = c.getParent(); } return result; }