【发布时间】:2019-02-14 21:05:59
【问题描述】:
我的代码类似于下面的示例,它允许我在不同的位置打开一个 shell。我需要做的是跟踪窗口位置(如果它被移动)并保存这些位置以供下次打开该窗口时使用。有什么建议吗?
public StartupSplashShell(Display display)
{
shell = new Shell(display, SWT.NO_TRIM);
setupShell(); // place components in the main avoCADo shell
shell.setText("avoCADo");
shell.setBackgroundImage(ImageUtils.getIcon("./avoCADo-Splash.jpg",
360, 298));
shell.setSize(360, 298); //TODO: set intial size to last known size
Rectangle b = display.getBounds();
int xPos = Math.max(0, (b.width-360)/2);
int yPos = Math.max(0, (b.height-298)/2);
shell.setLocation(xPos, yPos);
shell.setImage(ImageUtils.getIcon("./avoCADo.png", 32, 32));
shell.open();
}
【问题讨论】:
-
这是您遇到问题的代码吗?
-
这只是一个普通的 SWT 应用程序还是 Eclipse RCP 的一部分或...?