`
yeshaoting
  • 浏览: 667469 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

org.eclipse.swt.SWTException: Subclassing not allowed

阅读更多
错误: org.eclipse.swt.SWTException: Subclassing not allowed



创建一个继承Shell的类BorderTextShell后出错
因为在BorderTextShell构造方法中,
super(display, style);

要调用父类构造方法:
public Shell (Display display, int style) {
	this (display, null, style, 0, false);
}

Shell (Display display, Shell parent, int style, int /*long*/ handle, boolean embedded) {
	super ();
	checkSubclass ();
	...
}

其中,checkSubclass ()方法继承自Decoration类,用来验证子类是否存在于org.eclipse.swt.widgets包内.
若不在此包内,则报错.

解决办法:
1. package org.eclipse.swt.widgets;
2. 重写checkSubclass ()方法,方法体为空.即在子类中添加:
protected void checkSubclass()
	{
		
	}

3. 在类中声明Shell类的一个实例.(OO原则: 多用组合,少用继承)
  • 大小: 34 KB
分享到:
评论

相关推荐

    Speaking JavaScript

    Like it or not, JavaScript is everywhere these days—from browser to server to mobile—and now you, too, need to learn the language or dive deeper than you have. This concise book guides you into and ...

    ( [Python.in.Practice(2013.8)].Mark.Summerfield.文字版(英语)

    Using a Class Decorator Instead of Subclassing...... 58 2.5. Façade Pattern .............................................. 59 2.6. Flyweight Pattern............................................ 64 ...

    python3.6.5参考手册 chm

    Notable changes in Python 3.6.5 What’s New In Python 3.5 Summary – Release highlights New Features PEP 492 - Coroutines with async and await syntax PEP 465 - A dedicated infix operator for matrix...

    Softgroup Components.NET Subclass and Hook Objects v2.0.3870

    HookApplication: provides application-wide messages subclassing. This class allows an application to capture a message before it is dispatched to a control or form. HookClipboard: provides ...

    Prentice.Hall.C++.GUI.Programming.with.Qt.4.2nd.Edition.2008.chm

    Using Qt Jambi in the Eclipse IDE Integrating C++ Components with Qt Jambi Appendix D. Introduction to C++ for Java and C# Programmers Getting Started with C++ Main Language Differences The...

    This demonstrates hoe to write a subclassing control. And it

    This demonstrates hoe to write a subclassing control. And it has many examples as to how to use the control (included.)

    Principles of Distributed Database Systems

    Introduction . . . . . . . . . ....1.1 Distributed Data Processing .... ....1.3 Data Delivery Alternatives ....1.4 Promises of DDBSs ....1.4.2 Reliability Through Distributed Transactions ....1.4.3 Improved Performance...

    iOS.Programming.The.Big.Nerd.Ranch.Guide.5th.Edition.01

    Subclassing UITableViewCell Chapter 12. Stack Views Chapter 13. UINavigationController Chapter 14. Camera Chapter 15. Saving, Loading, and Application States Chapter 16. Size Classes Chapter 17. ...

    Java 8 Lambdas

    Default Methods and Subclassing 49 Multiple Inheritance 52 The Three Rules 53 Tradeoffs 54 Static Methods on Interfaces 54 Optional 55 Key Points 56 Exercises 57 Open Exercises 58 5. Advanced ...

    ZendFramework中文文档

    7.7.7. 继承(Subclassing)动作控制器 7.8. 动作助手 7.8.1. 介绍 7.8.2. 初始化助手 7.8.3. 助手经纪人 7.8.4. 内建的动作助手 7.8.4.1. 动作堆栈(助手) 7.8.4.2. AutoComplete 7.8.4.2.1. ...

    原创开源项目TinyFC代码

    这个项目的更新请留意此博文 ... 原创 原创开源项目TinyFC: 一个模仿大型类库MFC的小型类库(VB6实现) 收藏... Debug Object for AddressOf Subclassing Library Win C:\WINDOWS\system32\winU.tlb Windows API (Unicode)

    iOS.8.App.Development.Essentials

    Subclassing and Extending the iOS 8 Collection View Flow Layout Chapter 57. Drawing iOS 8 2D Graphics with Core Graphics Chapter 58. Interface Builder Live Views and iOS 8 Embedded Frameworks Chapter...

    ActiveX controls inside out 控制元件徹底研究

    ActiveX control licensing * Converting a VBX and subclassing Windows controls * 16-bit-to-32-bit and cross-platform issues * Microsoft guidelines for ActiveX Controls and control containers * Visual ...

    A freeware MFC class to support MFC subclassing(19KB)

    A freeware MFC class to support MFC subclassing(19KB)

    深入浅出ES6

    深入浅出ES6, epub格式 深入浅出 ES6(一):ES6 是什么 深入浅出 ES6(二):迭代器和 for-of 循环...深入浅出 ES6(十五):子类 Subclassing 深入浅出 ES6(十六):模块 Modules 深入浅出 ES6(十七):展望未来

    Subclassing the List View Control using MFC用MFC写的列表视图

    Subclassing the List View Control using MFC用MFC写的列表视图子类(3KB)

    Outlook 2003 SideBar V2.02 Alpha

    The control now uses subclassing from Paul Caton (thanks Paul) And the cMemdc for drawing From Vlad Vissoultchev (Thanks Vlad) Awesome code From two very talented programmers. Take a look and tell me ...

    iOS.9.App.Development.Essentials

    An Introduction to Swift Subclassing and Extensions Chapter 13. Working with Array and Dictionary Collections in Swift Chapter 14. Understanding Error Handling in Swift 2 Chapter 15. The iOS 9 ...

    This little control greatly simplifies the business of subcl

    This little control greatly simplifies the business of subclassing a form to get at the extra events that the Visual basic designers left out. i.e.:

Global site tag (gtag.js) - Google Analytics