| d2r diego's weblog |
the synth look and feel: what Sun should do next
But. There's very little documentation available. The most referenced article on Synth is this one by SwingMaster Scott Violet, which is a good intro but doesn't go into much detail. There's a mini-intro over at JDC. There's a more recent article by John Zukowski over at IBM DeveloperWorks which also covers the new Ocean L&F (which replaces the absolutely-positively-obsolete Metal L&F). Then there's the API docs for Synth and the Synth descriptor file format. And... that's about it, as far as I can tell. All the examples stop at the point of showing a single component, usually a JTextField or JButton. But, let's assume that documentation will slowly emerge. There is something that Sun should do as quickly as possible (and that in fact it should have done for this release), which is to use Synth for its own L&Fs. What better chance to show off Synth than to rewrite the Metal L&F in it? (I am fairly sure that this hasn't happened yet, since the way to load the Metal L&F remains the same, and all the Metal L&F classes remain under its javax.swing.plaf locations in the JDK 1.5 distribution). In fact, while we're at it, why not write all the look and feels with Synth, including Windows, which would make it much easier to correct the inevitable problems with it that appear after every release (and because of which something like winlaf exists)? This is also known in the vernacular as "eating your own dog food". :) Re-writing Metal in Synth would also be a perfect use-case that would serve both as a testing platform and example for others. As it stands, it's hard to know if this wasn't done because of performance limitations, limitations in Synth, time-constraints, or what. So I'd like to see Sun clearly spell out the reasons why Synth wasn't used for Metal, and where they are taking it next. I, for one, am not thrilled about the idea of yet another look and feel that will remain dead in the water (like Metal did all these years), when there are so many other important things that Sun could be improving in the JRE (platform integration, anyone?). If all L&Fs will eventually be Synth-etized, that would simplify usage and fixes of L&Fs for all developers (and maintenance on Sun's side), and prove that Synth is the way of the future. PS: it would also be a good idea to add built-in support for the notion of L&F hierarchies to Synth files (Currently all the commands must exist in a single file; you could create a single stream of XML descriptor out of multiple Synth files, but who's gonna do that?). Having to do copy+paste for everything and then changing two or three lines in a file because all you want is a different image somewhere doesn't sound like good practice to me. Categories: soft.devPosted by diego on November 6 2004 at 3:14 PM Comments (please see the comments & trackback policy).
Interesting! I'd seen some but not all of those articles. Regarding the restructuring of the Metal L&F and others into Synth files, Sun couldn't do that because of the need to preserve backwards compatibility. I have to admit, though, it would be nice to see a L&F like Metal or Ocean adapted to Synth as a fully-baked example. Regarding L&F hierarchies, I haven't tried this, but I looked at the Synth XML format document, and there's an attribute called "clone" that will allow one style (or state, or font, or whatever) to "inherit" from another, but alter selected attributes. Unfortunately, I didn't see a way to import another XML file into the current one, which would make that capability a lot more useful. Posted by: Eric Galluzzo at November 10, 2004 10:59 PMCopyright © Diego Doval 2002-2007.
|
