5/15/2008

How to customize NetBeans look and feel

NetBeans by default uses the platform native look and feel: windows look and feel on Windows, and Gtk look and feel on Linux and Solaris where Gtk 2 is available. While the windows look and feel is fine and pretty close to native windows applications, NetBeans doesn't look the best with Gtk look and feel. Here are some options to adjust them, in order of my preference:

1. Plastic looks from JGoodies. Go to JGoodies download page, choose "JGoodies Looks" among the list of download links. Runs with Java 1.4 or greater.

Unzip the download file (looks-2.1.4.zip) to somewhere, e.g., /home/xxx. The zip file contains a top-level root directory so no need to make a temp dir for unzipping.

Edit NetBeans-dir/etc/netbeans.conf file, appending the following options to netbeans_default_options (You may want to copy and comment out the original line for safety):

--cp:p /home/xxx/looks-2.1.4/looks-2.1.4.jar --laf com.jgoodies.looks.plastic.Plastic3DLookAndFeel
Note that netbeans_default_options value is quoted so after your editing, it should still end with ". Restart NetBeans to see the new look. You can also pass these options in command line when you start NetBeans and command line options will override netbeans_default_options in netbeans.conf file:

NetBeans-dir/bin/netbeans --cp:p /home/xxx/looks-2.1.4/looks-2.1.4.jar --laf com.jgoodies.looks.windows.WindowsLookAnd
JGoodies looks comes with the following look and feels:
com.jgoodies.looks.plastic.Plastic3DLookAndFeel
com.jgoodies.looks.plastic.PlasticLookAndFeel
com.jgoodies.looks.plastic.PlasticXPLookAndFeel
com.jgoodies.looks.windows.WindowsLookAndFeel
All of them are cross-platform, which means you can also use com.jgoodies.looks.windows.WindowsLookAndFeel on Linux. But it's not much different from swing metal look and feel. While trying Plastic3DLookAndFeel, PlasticLookAndFeel and PlasticXPLookAndFeel on my Linux laptop, I didn't see any noticeable difference among them.

2. Use the classic swing metal look and feel. Although not visually appealing, it has some benefits: (1) no additional jar on classpath; (2) consistent look and feel across platform; and (2) maybe a bit faster. To use metal, edit NetBeans-dir/etc/netbeans.conf:
netbeans_default_options="... --laf javax.swing.plaf.metal.MetalLookAndFeel"
Since NetBeans always sets look and feel whether you specify --laf option or not, the swing default look and feel does to take effect. Adding a file in JAVA_HOME/jre/lib/swing.properties has no effect either. It is not possible to use swing Windows look and feel on non-Windows platform.

3. If NetBeans is running on JDK 6 or greater, Install NetBeans Substance plugin. This is listed # 3, though recommended at NetBeans wiki page. You can download the plugin as a *.nbm file at NetBeans Plugin Portal, and install it following menu Tools | Plugins | Downloaded tab | Add Plugins... button. Once installed, a wide variety of skins can be chosen from menu View | Skins. You can change skin at any time without restarting NetBeans.

I tried all skins and they seem to be very similar, differing only in colors used. The good ones (good to my eyes) are "Moderate" and "Business *". One thing I don't like is that they all auto-hide the plus sign in front of the folder icon inside File and Favorite panel, which I found is very annoying and distracting. When the mouse moves on the left panel, the on-focus elements changes background color. I find it confusing since the current selected element is also highlighted.

After trying it for a couple of days, I decide to unininstall it (Tools | Plugins | Installed tab, select the plugin and click Deactivate on the right, or click Uninstall button on the bottom).

4. Napkin look and feel, making you feel like coding on a napkins. I don't quite like its informal style but others may. Links: overview & snapshots, download, instructions.

5. Nimbus look and feel in JDK 6 update 10 (beta as of 5/15/2008). See here for a comparison to metal. To use it with NetBeans, install JDK 6 update 10, set netbeans_jdkhome to JDK 6u10, and netbeans_default_options to include "--laf com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel" in NetBeans-dir/etc/netbeans.conf.

Wtih Nimbus, I can only see the selected items on my left panel (File, Favorite, or Project views). Other elements all have the same color as the white background so are invisible. Will try it again when the final JDK 6u10 is out.

3 comments:

Sinan said...

I tried nimbus today. It is very clean.But, On Netbeans 6.1 with latest updatesand jdk1.6u10 rc2 it has bugs, some window content is not visible. Output window black and treeviews are white on white. But it works great on NetBeans 6.5Beta. Everything seem ok.

Vince. said...

Ditto for me. Upgraded Netbeans from 6.1 to 6.5rc2 and, using jdk 1.6u10, Nimbus appears to work well.

maulin said...

hello my name is maulin
i just create a application in netbeans using nimbus look and feel but whan i build it and create a jar file and run the jar file nimbus look and feel are not working default metal theme are shown so please give me sollution