@Override public String getKeyAtPoint(Point p) { Component comp = panel.getComponentAt(p); if (comp instanceof SegmentPropertiesListCell) { return ((SegmentPropertiesListCell) comp).key; } return null; } }
public Component getComponentAt(int x, int y) { getLayout().layoutContainer(this); Component result = super.getComponentAt(x, y); System.err.println("getComponentAt " + x + "," + y + " returning " + result.getName()); return result; }
public Component getComponentAt(int x, int y) { getLayout().layoutContainer(this); Component result = super.getComponentAt(x,y); System.err.println("getComponentAt " + x + "," + y + " returning " + result.getName()); return result; }
public Component getComponentAt(int x, int y) { getLayout().layoutContainer(this); Component result = super.getComponentAt(x,y); System.err.println("getComponentAt " + x + "," + y + " returning " + result.getName()); return result; }
Component comp = mainParentPanel.getComponentAt(location); if (comp instanceof JSplitterBar) {
/** * Implements method for the <tt>MouseListener</tt> interface to initiate * shape dragging. * * @param evt * The associated mouse event. **/ public void mousePressed(MouseEvent evt) { Component c = m_panel.getComponentAt(evt.getPoint()); if (c instanceof ShapeComponent) { m_selectedComponent = (ShapeComponent) c; m_panel.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR)); m_panel.addMouseMotionListener(this); m_selectedComponent.repaint(); } }
Component c = panel.getComponentAt(e.getPoint()); // compare with panel.findComponentAt System.out.println("Open context menu for " + c.getName());