Link to home
Start Free TrialLog in
Avatar of RightSoBosco
RightSoBosco

asked on

Wrapping Swing Components

Hi, I want to create wrapper classes for most of the Swing GUI Components such as JButton, JTextField etc etc.
I want to keep this very simple but how do I go about doing this properly?

For example in the case of JButton, I will want a wrapper class MyJButton which will have colours and sizes specified by my wrapper class. So when I want a button I create a myJButton which will have a specific look and feel.

How do you properly wrap these classes. Would you simply subclass for example
public class MyJButton extends JButton
and then just set up the various attributes ?

Or alternatively does anyone know of any Look and Feel coding guidelines ?
I want to ensure that everyone when using the Swing components are forced to adhere to the same look and feel.

Thanks for your help
Regards Dave


 
Avatar of zzynx
zzynx
Flag of Belgium image

>> Or alternatively does anyone know of any Look and Feel coding guidelines ?
Java Look and Feel Design Guidelines, Second Edition: http://java.sun.com/products/jlf/ed2/guidelines.html
Some links on custom components here:

http://www.swtech.com/java/guidev/guicomp/
SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of limaideal
limaideal

jgoodies.com already have lots of freel, mature look and feels
Instead of creating a wrapper for each a better way would be to use the UIManager class to specify the default properties of the various component types
Avatar of RightSoBosco

ASKER

Thanks for all the links :)

objects
When you say I should use the UIManager class to specify all the default properties.
Would this be similiar to the way the way it was done with this:
http://liquidlnf.sourceforge.net/
or is the liquidinf way too over the top ?




ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you want to generate the UI Defaults file yourself: http://www.rgagnon.com/javadetails/java-0507.html
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the all the links and help there.
I split the points amonts three different parts which helped me out  the most.
Thanks again :-)
 
Thanks