|
|
|
|
Re: Why SWT widget can not be implemented? [message #451402 is a reply to message #451397] |
Tue, 01 March 2005 04:15   |
Eclipse User |
|
|
|
Zhu Jie wrote:
> Here is my code....
> org.eclipse.swt.SWTException: Subclassing not allowed
> at org.eclipse.swt.widgets.Widget.checkSubclass(Widget.java:260 )
> Pls help, thx a million!
Hi Zhu,
you should still think if it is any sense to hack the SWT.
According SWT, it is useless to subclass its standard Widgets.
If you like your own class, you could use composition
(take a look of "Effective Java Programing" book : "Favor composition
over inheritance" Chapter), something as
class MyButton {private Button swtButton;}
Anyway, just to answer to your question, here is the code that generate
the error (Widget.isValidClass()):
name.substring (0, index + 1).equals (PACKAGE_PREFIX);
static final String PACKAGE_PREFIX = "org.eclipse.swt.widgets.";
That means, you have to create a package "org.eclipse.swt.widgets." and
put there your MyButton.
Tiberiu
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05204 seconds