Note the current approach may not work with other platforms / look and feels. If your current project is intended to work only on your Mac and you don't plan change this in the future, well in that case it might work. But normally Java applications are intended to work across different platforms and look and feels.
Having said this you may want to take a look to this interesting article about most popular look and feels defaults: All UI defaults names for common Java look and feels on Windows, Mac OS X, and Linux. When you look at the tables then you'll see not all L&Fs support the same properties and may ignore them when create an UI object (f.i. TabbedPaneUI
).
If you like Mac L&F (I do) then I'd suggest you try customizing Seaglass Look and Feel which is pretty similar than Mac's. This way you will get this benefits:
- Standard cross-platform L&F similar to Mac's L&F provided with your app.
- Customize the L&F and this change will be also cross-platform.
- Unify user experience (non trivial matter). Probably you and me will be able to work with the same app on Mac OS, Windows or Linux with different L&F. But many users can't do it: they get lost when the GUI looks different.
To customize Seaglass you can list the default properties as follow:
for(Object key : UIManager.getLookAndFeel().getDefaults().keySet()) {
System.out.println(key + " = " + UIManager.get(key));
}
These are quite much and I really don't have time enough to give you a working example so I hope the idea is good enough to help you.
Note
If you don't want frames and dialogs have the default decoration provided with Seaglass (it's pretty ugly to me) then you need to do as follw:
UIManager.setLookAndFeel(new SeaGlassLookAndFeel());
JFrame.setDefaultLookAndFeelDecorated(false);
JDialog.setDefaultLookAndFeelDecorated(false);
This way frames and dialogs will have their Window decorations provided by the current window manager (up to the OS).