【问题标题】:Stop further execution when a SWT shell is opened打开 SWT shell 时停止进一步执行
【发布时间】:2015-09-22 09:30:33
【问题描述】:

SWT 视图说“CalculateView”被创建并打开,然后是某些代码行说“change()”。仅当单击CalculateView shell 中的保存按钮时才释放SWT shell。 "change() 方法代码对一些变量进行了一些更改,影响了 shell 的保存按钮中的代码。所以我需要在 shell.open() 之后停止代码的执行,直到单击 CalculateView 中的保存按钮。

Shell shell =  =new Shell().
CalculateView view= new CalculateView(shell);
shell.open();
change();

在CalculateView里面我有保存按钮。

  CalculateView()
    {
    ToolItem save = new ToolItem();
    save.addSelectionListener({
    @Override
            public void widgetSelected(SelectionEvent e) {
                getshell().close();
          }
    });

【问题讨论】:

    标签: java multithreading shell swt


    【解决方案1】:

    我理解如果你不把下面的行和窗口将被破坏,执行将继续。

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-23
      • 2021-04-22
      • 1970-01-01
      • 2017-08-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多