SWT能不能动态改变Shell的Style

解决方案 »

  1.   

    ms不能,不过你可以在这个shell里放一个顶满的composite
    需要换style的时候,把这个composite按需要的style重新new一下
      

  2.   

    我想让子Shell在后,让父Shell在前可以实现吗?
      

  3.   

    饿……第一次见一个进程起2个shell的试了下,ms不能
      

  4.   

    应该是可以的,你用swt的child = new Shell(parent);创建一个子窗口后,焦点是在子窗口的,只要你的子窗口不是模态貌似点击父窗口就可以让父窗口在子窗口前面了,你试试看看
      

  5.   

    我写了个出来,可以在NO_TRIM与SHELL_TRIM中动态转化,也可以运行.
    import org.eclipse.swt.SWT;
    import org.eclipse.swt.events.SelectionEvent;
    import org.eclipse.swt.events.SelectionListener;
    import org.eclipse.swt.layout.RowLayout;
    import org.eclipse.swt.widgets.Button;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell;public class ShellTest implements SelectionListener {
    private Display display;
    private Shell shell;
    private Button button;
    private boolean flag = false; public ShellTest() {
    display = new Display();
    shell = new Shell(display);
    shell.setLayout(new RowLayout()); build(); shell.open();
    while (!shell.isDisposed())
    if (!display.readAndDispatch())
    display.sleep();
    display.dispose();
    } private void build() {
    button = new Button(shell, SWT.PUSH);
    button.setText("Push ME");
    button.addSelectionListener(this);
    } public void widgetSelected(SelectionEvent evnt) {
    if (flag == true) {
    shell.dispose();
    flag = false;
    shell = new Shell(display, SWT.SHELL_TRIM);
    shell.setLayout(new RowLayout());
    build();
    shell.open();
    } else {
    shell.dispose();
    flag = true;
    shell = new Shell(display, SWT.NO_TRIM);
    shell.setLayout(new RowLayout());
    build();
    shell.open();
    }
    } public void widgetDefaultSelected(SelectionEvent evnt) { } public static void main(String[] args) {
    new ShellTest();
    }
    }
      

  6.   

    应该是可以的,只要在父Shell在open()之前open()子Shell就可以了.过这样的话 父shell要显示就必须等到子shell关闭
      

  7.   


    这个看似可以,但子Shell并不在父Shell后面,只是可以操作父Shell