Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » customizing swt widget
customizing swt widget [message #465954] Mon, 26 December 2005 06:50 Go to next message
andy is currently offline andyFriend
Messages: 10
Registered: July 2009
Junior Member
i wanna develop my swt widget. (e.g. MyButton)
MyButton support some properties (e.g. setRolloverIcon,
setPressedIcon,setDisabledIcon and something like SWING JButton's

so, I try to make MyButton extending Button.
but it's restricted to be subclssing

alternatives are extending composite or extending canvas.
but both are not easy to expose basic Button properties to user.

what is better idea?
Re: customizing swt widget [message #465972 is a reply to message #465954] Tue, 27 December 2005 16:42 Go to previous message
Daniel Spiewak is currently offline Daniel SpiewakFriend
Messages: 263
Registered: July 2009
Senior Member
You can subclass Button as long as you're extremely careful to only use/override the public API and not the internal methods (even the public ones) which aren't declared as platform agnostic. Otherwise you'd have to create a new subclass for each platform and would have to change it practically with every milestone. To extend Button (or any SWT widget) use the following:

protected void checkSubclass() {
    if (!getClass().getName().equals("com.custom.MyButton"))
Previous Topic:control widget on main form from composite?
Next Topic:Standard SWT Menu Icons
Goto Forum:

Current Time: Mon Sep 23 11:13:40 GMT 2019

Powered by FUDForum. Page generated in 0.01613 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top