Shell不能扩展子类有关问题

Shell不能扩展子类问题在开发过程中,有时需要断承Shell定义自己的shell,,但运行过程会抛出错误:Subclassin

Shell不能扩展子类问题
在开发过程中,有时需要断承Shell定义自己的shell,,但运行过程会抛出错误:Subclassing not allowed


解决办法:

   1)覆盖父类shell.checkSubclass()方法,方法体为空

    @Override
    protected void checkSubclass(){
     //Nothing
    }

  2)定义的子类包名为 org.eclipse.swt.widgets.xxxx

   package org.eclipse.swt.widgets.custom
   import org.eclipse.swt.widgets.Shell
   public class MyShell{
     //Code here
   }