Reputation: 129075
I have used a few different Look and Feels for Java Swing, but I don't really like anyone to 100% so I often end up with customizing it a lot. Sometimes I am thinking about if it is a better idea to write my own LaF (by extending an existing one), but I don't really know.
For the moment, I mostly use Nimbus, but I change all colors (to darker ones) and rewrite the appearance of some components, like sliders and scrollbars. I also mostly customize all tables and I am thinking about to change the look of a few other components.
When is it recommended to create a new Look-and-Feel instead of customizing one? What are the pros and cons?
I.e. customize Nimbus or create a new one by extending Nimbus?
Related article: Creating a Custom Look and Feel (old)
Upvotes: 2
Views: 3395
Reputation: 206
Writing a Java look and feel is not for the faint of heart. It's an endeavor in itself, which is why I'd say that it's probably more efficient to find a pre-existing look and feel that suits your needs.
Kathryn Huxtable has been working on the implementation of the Sea Glass Look and Feel, which has been quite an undertaking. It's based on Nimbus, though Nimbus and it's Swing underpinnings are not nearly as extensible as is required to create a custom look and feel. That means that much of the code must be copied and pasted into sub-classes. You likely don't want to get side-tracked with this kind of thing, when working on another project.
Synthetica is also another pre-existing option, which I believe is quite skin-able.
Upvotes: 0
Reputation: 28333
When is it recommended to create a new Look-and-Feel instead of customizing one?
Here's an example of the kind of sickness you have to go through to enhance a tiny bit the pathetic JTable (btw the author of this blog later got hired by Apple):
http://explodingpixels.wordpress.com/2009/05/18/creating-a-better-jtable/
What are the pros?
It is possible to make an app look nearly identical (the only difference being the font rendering, which slightly varies from OS X to Linux to Windows... but it can be made to be quite close, or you can go with "non AA" pixel-perfect fonts, that will look perfectly identical).
and cons?
I've written several custom Swing components looking exactly the same on Windows, Linux and OS X (using pixel-perfect fonts) but I wouldn't write an entire LnF.
Upvotes: 6
Reputation: 719576
I don't think there are any answers to this question except for generalities like:
when the effort of applying the changes to the existing Look-and-Feel is greater than creating a new one, or
when you want to create a new Look-and-Feel for non-technical reasons.
Upvotes: 0