This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
If I do a UIManager.setLookAndFeel(...) at the start of my application, do I need to check if my LookAndFeel is what I expect in other GUI classes, or can I rest easy that for the life of the app running, the LookAndFeel I initially set will be there?
Hi Bill, I think the question is: what are you setting the look and feel to? If you are setting it to Windows or to Macintosh L&F, then there is no guarantee that your examiner will have such a platform (and those L&Fs cannot be distributed), and so what they see may be totally different to what you planned. My recommendation would be not to set the look and feel at all. You might want to set it yourself just for testing purposes, but do most of your design work with the default L&F. That way it should look the same on all platforms. Regards, Andrew
Hi Bill, OK, I understand what you are trying to do now. To answer your original question - I believe that once you have succesfully set the look and feel, then it should remain in effect for the remainder of your applications life. Personally I didn't set the look and feel. That way the user could use a different look and feel if they really wanted to, but by default it would be the Java Look and Feel. Regards, Andrew
Would it be acceptable to set the look and feel to the classname returned by UIManager.getSystemLookAndFeelClassName() ? That would set to the correct native look and feel (if there is one), and if it fails no harm is done. (I say this because personally I cannot stand Metal and I think their windows look and feel is pretty accurate)