Creating reusable component - How to register Skin?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Creating reusable component - How to register Skin?

Andrew Brampton
I am making a HexEditor component, that can efficiently scan through a large file. I want the component to be re-usable, but I've hit a problem with the Skin.

For my component to work, I have to call:
Theme.getTheme().set(HexEditor.class, HexEditorSkin.class); 

I don't really want my users to have to do that.

So what's the best practice here?
Should I call that from within my HexEditor constructor? At the risk of overriding something the user may have set,
Or should I tell my users to register the Skin themselves?

thanks
Andrew
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Creating reusable component - How to register Skin?

Roger Whitcomb-2

Any subclass of Component can call the “setSkin( skin object )” themselves (and should) during the constructor.

 

HTH,

~Roger

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Andrew Brampton
Sent: Saturday, February 22, 2014 8:04 AM
To: [hidden email]
Subject: Creating reusable component - How to register Skin?

 

I am making a HexEditor component, that can efficiently scan through a large file. I want the component to be re-usable, but I've hit a problem with the Skin.

 

For my component to work, I have to call:

Theme.getTheme().set(HexEditor.class, HexEditorSkin.class); 

 

I don't really want my users to have to do that.


So what's the best practice here?

Should I call that from within my HexEditor constructor? At the risk of overriding something the user may have set,

Or should I tell my users to register the Skin themselves?

 

thanks

Andrew

Loading...