2014-01-25 31 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窗口并将其打开。因人而异。