2014-01-25 30 views
0

比方說,一類AnotherShell從加載文件創建一個動態的外殼

public class AnotherShell 
{ 
    private Shell shell; 
    public AnotherShell() 
    { 
     shell = new Shell(Display.getCurrent()); 

     Button btnNewButton = new Button(shell, SWT.NONE); 
     btnNewButton.addSelectionListener(new SelectionAdapter() { 
      @Override 
      public void mouseUp(SelectionEvent e) { 
       System.out.print("Selected\n"); 
      } 
     }); 
    } 
    public void open() 
    { 
     shell.open(); 
    } 

    public void close() 
    { 
     shell.setVisible(false); 
    } 
} 

我不知道是否有可能這個保存到一個文件,不是從沒有這個代碼加載該文件的程序和「重新創建」窗口,就好像它是代碼的一部分一樣...

回答

0

排序回答:no(除保存&加載屏幕截圖外)。

龍答:讓AnotherShell序列化並將其存儲在與包含源代碼的另一個文件的文件。讓其他程序dynamically load的代碼和反序列化AnotherShell窗口並將其打開。因人而異。