Tuesday 3 February 2009

Swing 2 - a feature list

There is a very interesting discussion going on over on Jonathan Giles blog to do with features would be nice for Swing 2. He seems intent on keeping the features at a reasonable level, which I think is commendable; for example language changes like properties are left off the table.

I thought that I'd follow up with a few of my own thoughts:
  1. Painters would be awesome, being able to plug in your own painting code for defined parts of a component without doing dirty LnF hacks would save lots of my time. They do however have their problems, namely sizing. The painting logic of a component is intrisicly linked to the size of that component, the space needed for the component to paint its self should also be part of the painter. Adding an API like the fitInto API in the sclabaleicon project to painters would allow this to happen.
  2. While I'm at it adding this API to component its self would also remove the two confising minimum and maximum size APIs
  3. Now I don't know if this one is possible or not but some way to make UIDefaults type safe would be great, maybe the decorator pattern or something like that. I have no idea if that would work or not but it could facilitate making more of a seperaton between the controller and the ui, I mean text-icon gap should really be in the ui, come to thing of it so should font, foreground/background colour, text alignment, cell spacing, and most of the other properties found in the swing components. Imagine being able to do something like component.getUI(TextUI.class) to get text related ui properties like antialiasing or decoration or font, or component.getUI(NimbusUI.class) to get type-safe properties for the numbus look and feel.
Anyway, that's just a few ideas that would be nice to have, let's hope that sun get back to Jonathan soon about what they think.

1 comment:

  1. Hey Matt - thanks for the link to my blog. Did you post these thoughts as a comment on my site - if not please consider doing so. This way we have a single site aggregating everyones thoughts on this issue.

    Cheers,
    Jonathan

    ReplyDelete