This tells you how to install "Java Look and Feels". If you're wondering where to get a look and feel to try out then you might want to try Javootoo.com for a list of sites that offer different LF's. The LF that will be used in this tutorial is the 3D Look and Feel which can be downloaded from Markus Hillenbrand. I don't link directly to the download because of I don't want me or Developer Fusion.com to get in trouble for linking directly to it. Anyway finding the download area isn't too hard, just download it and unzip it to get the JAR File which is what we want anyway. (The JAR is where the LF is :))
Installing Your New Look and Feel
To install the LF, just put the JAR file in the jre\lib\ext folder of your SDK mine looks like C:\j2sdk1.4.0\jre\lib\ext\ and if you have a separate JRE that you use like I do then put a copy in the lib\ext of that too. That's all you need to do to install a LF. Oh and put a copy on your desktop or somewhere easy to find on your OS.
I will be assuming that you are using windows now because that's all the author
of this document knows about. OKay? OK.
Alright now, you programmer, you know that to change the look and feel of a program you go like this:
UIManager.setLookAndFeel(Look and Feel Class Name Here);
SwingUtilities.updateComponentTreeUI(JFrame goes here);
But how do we know the class name of the LF we just got? We don't. Or at least: not yet.
Finding the Class Name
Note: Sometimes the web site will give it to you so you don't need to do the following!
Bring up a command prompt and set the path to the path of SDK, for example
cd c:\j2sdk1.4.0\bin [enter]
Got that? Now, type:
jar tf path of JAR File here
c:\j2sdk1.4.0\bin> jar tf 3dlf.jar [enter]
While it's scrolling down be on the lookout for the LookAndFeel.class ending to one of the lines. And also when it stops look for that ending again if you missed it. Alright, cool, you found something like this (If you are using the 3DLF.JAR like I said you should)
Then for the class name to use in
(that is, the \'s turn to "."'s and the .class is left off). So the code now looks like:
Now that you know the class name you can even make you LF the default by editing (or creating one) the swing.properties file in your JRE's lib folder to look like:
# Swing properties swing.defaultlaf=Look and feel class Name Here
Alright, that's it about Look and Feels. The End.