| Mac L&F | Discovering Active L&Fs | Gotchas |
| Selecting Programmatically | Decorating | Learning More |
| Command Line | Icons | Books |
| Discovering Installed L&Fs | Overriding | Links |
public boolean isSupportedLookAndFeel() { return isNativeLookAndFeel(); }to this one:
public boolean isSupportedLookAndFeel() { return true; }However, if you released code that did that, the Apple lawyers would be down your neck. Even if you used the third party QuaQua L&F that more closely mimics the Mac OS X UI than Sun’s L&F does, you would get in legal trouble if your app allowed QuaQua to run on anything but a Mac, except for development testing. If you use QuaQua, you must bundle the quaqua.jar with your application/Applet and ensure it is on the classpath.
Using the Nimbus look & feel that comes with JDK 1.6.0_10+, is tricky since the class file that implements it might not be present. You want at all costs to avoid a NoClassDefFoundError.
// discovering the current active Look and Feel LookAndFeel laf = UIManager.getLookAndFeel(); String lafName = laf.getName();
// Get an icon that looks just like the one the L&F uses // for closing internal frames. Icon closeIcon = UIManager.getIcon( "InternalFrame.closeIcon" );
// overriding a colour in the L&F UIManager.put( "TabbedPane.selected", Color.RED );The values you can feed to UIManager.put are undocumented, but you can learn about them by studying the source code in src.zip for javax.swing.basic. BasicLookAndFeel. java.
Another approach is to write your own Look & Feel that extends some other one, and just overrides a few font-defining methods or colour-defining methods. See this sample code for a writing a derived LAF.
// persuade Swing to use your custom class loader to load LAF classes UIManager.getDefaults().put( "ClassLoader", loader );
![]() |
recommend book⇒Java Look and Feel Design Guidelines (2nd Edition) | |
| paperback | ||
|---|---|---|
| ISBN13: | 978-0-201-72588-9 | |
| publisher: | Addison-Wesley | |
| published: | 2001-03-19 | |
| by: | Sun Microsystems | |
| This book contains no code. It about how to design a good UI using Metal as an example. It contains Sun’s standards for how many pixels to use for various purposes. | ||
![]() |
recommend book⇒Java Look and Feel Design Guidelines: Advanced Topics | |
| paperback | ||
|---|---|---|
| ISBN13: | 978-0-201-77582-2 | |
| publisher: | Addison-Wesley | |
| published: | 2001-12-27 | |
| by: | Sun Microsystems | |
| It is about how to design a good UI using Metal as an example. | ||
![]() |
recommend book⇒GUI Bloopers: Don’ts and Do’s for Software Developers and Web Designers | |
| paperback | ||
|---|---|---|
| ISBN13: | 978-1-55860-582-4 | |
| publisher: | Morgan Kaufmann | |
| published: | 2000-03-17 | |
| by: | Jeff Johnson | |
| Works by analysing 82 examples of bad design. | ||
| You can get the freshest copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | |
| http://mindprod.com/jgloss/laf.html | J:\mindprod\jgloss\laf.html | |
![]() | ||
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.191.107] | |
| Feedback | You are visitor number 24,138. | |