| 发表于:2008-01-15 21:51:102楼 得分:0 |
public void lblbeijing_mousepressed(mouseevent e) { thex = e.getx();//鼠标第一次按下位置 they = e.gety(); } public void lblbeijing_mousedragged(mouseevent e) { int x = this.getx() + e.getx() - thex;//e.getx()是鼠标当前位置,e.getx() - thex是挪动距离 int y = this.gety() + e.gety() - they;//this.gety()窗体的位置 this.setlocation(x, y);//窗体摆放 } | | |
|