java中为什么用 mouseClicked取得的鼠标位置有偏移?
publicvoidmouseClicked(MouseEventarg0){//TODOAuto-generatedmethodstubintmouseclick_x=...
public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub
int mouseclick_x=arg0.getX();
int mouseclick_y=arg0.getY();
System.out.println("x轴:"+mouseclick_x);
System.out.println("x轴:"+mouseclick_y); this.repaint(); }
好像这样获得的坐标是以JFrame为参照的,是吗,各位大神,帮帮忙? 展开
// TODO Auto-generated method stub
int mouseclick_x=arg0.getX();
int mouseclick_y=arg0.getY();
System.out.println("x轴:"+mouseclick_x);
System.out.println("x轴:"+mouseclick_y); this.repaint(); }
好像这样获得的坐标是以JFrame为参照的,是吗,各位大神,帮帮忙? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询