> In the current Action architecture it is very
> difficult to use meaningful property keys other than

> those statically defined in Action to set up a 
> AbstractButton. For example if I were to add a 
> ROLLOVER_ICON property and wanted to be able to add 
> my Action to a toolbar directly I would have to 
> subclass JButton to use the new property and then
> JToolbar to use that button. This somewhat runins
> the conveniance of Action.

In this regard Swing is a little nebulous about who is
in control of customizing components.  Swing allows
for some customization, but it's limited to what they
had thought of prior.  Plus, this customization occurs
in two places.  One it's controlled by the UI classes
or the LNF.  However, as you pointed out some
customization occurs in the Action.  (ICON, text,
etc).  So which is it?  Does the action control the
customization or does the LNF?

I suppose this is why the Swing team included the
ability to customize single components with Auxiliary
LNFs.  Therefore, you can subclass a UI class, and for
JButton override some features in say BasicButtonUI,
and provide those features across your entire app
without needing to rewrite a LNF.

I would say that that's the cleanest approach if you
want to provide that feature to everywhere you have a
button.  However, you can do a lot with MouseListener,
PropertyChangeListener, and other listeners that can
be installed on Components.  And shift the
responsibility of customizing class to the class
building your components.  For example, create a
PropertyChangeListner that checks your ROLLOVER
property in the Action and sets the ROLLOVER Icon on
your button.  That can be reused in lots of different
places, but you must be in charge of constructing the
components correctly for it to work.  (Factory methods
come to mind here).

charlie

__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to