public class PuzzleFrame extends Shell
{
public PuzzleFrame()
{
super();
Display display=Display.getDefault();
setBounds(100,100,400,400);
layout();
open();
while(!isDisposed())
{
if(display.readAndDispatch())
{
display.sleep();
}
}
display.dispose();
}
Exception in thread "main" org.eclipse.swt.SWTException: Subclassing not allowed
Shell是不允许被继承的,在SWT的文档中,关于Shell类,你可以看到
IMPORTANT: This class is not intended to be subclassed.
事实上SWT的类大多是不可以被继承的。
可以继承,很多人就是用继承!
你这个代码最后少了个},加上可以通过编译!还有问题,肯定出在别的地方!和继承无关!