Improving Swing actions
Hope this is the right place to post (thought of using bug database on java.sun.com, but maybe this forum is more useful, at least, at first...)...
I'm making a small Swing application at present, and am extend AbstractAction to have a clean design (instead of anonymous ActionListeners and suchlike). Some actions appear in menus, some appear in the toolbar, and so on. In the menus, I'm using 16x16px icons, but for clarity, I'd like to use 24x24 icons in the toolbar. Given that the same Action object is shared between the menu AND the toolbar in some cases (that's the whole point of actions...), such icons are either too small for the toolbar or too large for the menu.
Perhaps "action-aware" components like menus and toolbars could have a method such as setActionIconSize(d:Dimension) (with a null "d" indicating current default behaviour), where (if specified) automatic resizing is performed. Alternatively, and I probably prefer this solution, additional properties could be specified for the Action interface, such as TOOLBAR_ICON and MENUBAR_ICON that override SMALL_ICON if specifed.