Custom Swing look and feel vs. custom components?
I'm writing a game using Swing and want to achieve a distinctive "steampunk" inspired look for the GUI. This will require some animated components, chunky metallic borders etc.
I know that I can get nice effects by overriding paintComponent and doing all of my rendering for custom lightweight component开发者_如何学编程s in that method.
Is this the way to go, or should I be looking at developing a whole new pluggable Look and Feel?
What are the pros/cons of each?
Personally, I think you should go for a completely new look and feel... you may also be able to build it off of Synth L&F rather than writing everything on your own.
Nimbus is an example of an L&F written on top of Synth.
Creating a new L&F is a longer road, but keeps your code simple. (If you only need a few changes it's not worth the effort.) For example, the animations can be coded in the L&F part, so you don't need to worry about it in your components. I would suggest to edit a L&F that is close to what you need.
精彩评论