读书人

Shell不能扩展子类有关问题

发布时间: 2012-07-01 13:15:00 作者: rapoo

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
}

读书人网 >开源软件

热点推荐