在shell上添加方法
shell.addControlListener(new ControlListener() {
public void controlMoved(ControlEvent e) {
System.out.println("窗口位置移动了");
shell.setLocation(100, 200);
}
public void controlResized(ControlEvent e) {
System.out.println("窗口大小改变了");
}
}
完整示例如下: