Point imgPoint=source.getLocation();Point point=e.getPoint();source.setLocation(imgPoint.x+point.x-pressPoint.x,imgPoint.y+point.y-pressPoint.y);pressPoint为保存拖放标签时的起始坐标 this.x=e.getX();...
Point p=MouseInfo.getPointerInfo().getLocation();drawCenteredCircle(g,p.x,p.y,3);} }));panel.add(addNodeButton);this.add(panel);setVisible(true);} public static void main(String a[]){ new Main();} ...