swt的窗口问题 解决追加100分

来源:百度知道 编辑:UC知道 时间:2024/06/17 05:11:50
有两个程序,如下,独自运行都可以运行。但是当打开第一个程序后
再打开第二个程序,第二个程序的窗口不能弹出来。我是要做一个定时提醒的工具。到了某个时间自动弹出调用第二个程序。

public class mainFrame {

public Shell shell;

public static void main(String[] args) {
try {
mainFrame window = new mainFrame();
window.open();
System.out.println("ed");
} catch (Exception e) {
e.printStackTrace();
}
}

public void open() {
final Display display = Display.getDefault();
createContents();
CreateTray.startTray(shell);
shell.open();
controller.jobInitial();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}

protected void createContents() {
shell = new Shell();

后面就不贴出来了

public class Popup extends Thread {
Shell shell;
Display display;
protected int moveStep = 2; // 每次移动的pixel
pr

在这个里面有一个时间的监听器,我曾经做过一个自动关机,就是用的这个监听器,他可以根据你的需要,做出一个某一个时间点或某一段时间过后执行一段程序(你只需要把这个段程序改成你的窗口弹出就可以了)

没看到你在哪里调用Popup 啊
你可以把你的Popup 单独写成一个类,就像你的Contents那样.至于要调用几次,这个由你决定