我有一个坐标为 e.getX() 和 e.getY() 的 mouseMoved(MouseEvent e) 方法。现在我想检查鼠标是否在一个顶点上。有没有办法做到这一点?
我不想检查单元格(顶点)是否被选中,我只想检查鼠标是否在一个顶点上。
mGraph = new mxGraph();
// create vertexes ...
mGraphComponent = new mxGraphComponent(mGraph);
//mGraphComponent.getGraphControl().addMouseMotionListener(new MouseAdapter() {
mGraphComponent.getGraphControl().addMouseMotionListener(new mxMouseAdapter() {
@Override
public void mouseMoved(MouseEvent e)
{
System.out.println(Integer.toString(e.getX()) + " " +
Integer.toString(e.getY()));
// here I want to check if the mouse position is over a cell
// I only want to check if the mouse is over one (or more?) cells
}
}
);
mPanel.add(mGraphComponent);