How to change look and feel of NetBeans

Posted by Petr Pisl on Dec 03 2008, 10:34:56 AM CET

If you want a different appearance of NetBeans than it is the native one you can simple change the look and feel (L&F). There can be also another reason for changing look and feel due to a bug in Windows L&F. When you are on Windows machine and you use the native Windows look and feel you can run into a problem with focus. Switching between NetBeans IDE and for example Firefox using Alt+TAB and sometimes when switching back to the IDE instead of being focused in the editor where you left it, the menu is focused instead. 

Some  L&Fs are available in Sun Java and many L&Fs are available on internet. Using L&Fs that are in Sun JDK is simple. You should know which Java you use and which version. For example Nimbus L&F is available from Sun JDK 1.6. You can run NetBeans with this L&F in two ways. The first one is running NetBeans from command line with --laf option. This way is sufficient, if you want to just try a L&F. So on *nix OS it's :

/path_where_netbans_are_installed/bin/netbeans --laf com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel

The second way is put the --laf option to the netbeans.conf file. The netbeans.conf file is located in etc folder in NetBeans installation folder. Open the netbeans.conf file and add the option into netbeans_default_options. When you do it in this way, then it's permanent and NetBeans will always start with this L&F.

There are a few screenshots of NetBeans with some L&F, which are available in Sun JDK 1.6.

Nimbus: --laf com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel

Metal: --laf javax.swing.plaf.metal.MetalLookAndFeel

GTK: --laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel

As I wrote above, we are not limited only with L&Fs, which are available in a JDK. You can dowload different L&Fs from net. Some of them are open source and free, but there are also commercial. If you want to use such L&F, you have to download a jar that contains the L&F definition and put it on NetBeans classpath. When you want to try a L&F on the command line, then you run NetBeans also with -cp:p path_to_L&F_jar option, which adds the jar on the NetBeans classpath. For example the command for using Liquid L&F will be:

/path_where_netbans_are_installed/bin/netbeans --laf com.birosoft.liquid.LiquidLookAndFeel -cp:p /path/to/liquidlnf.jar

You can put both options into default netbeans_default_options in netbeans.conf file, if you want to use command line.

There are a few examples. You can download the jar from the projects page and play with them.

Liquid: --laf com.birosoft.liquid.LiquidLookAndFeel -cp:p /path/to/liquidlnf.jar

Napkin: --laf net.sourceforge.napkinlaf.NapkinLookAndFeel -cp:p /path/to/napkinlaf.jar

NimROD: --laf com.nilo.plaf.nimrod.NimRODLookAndFeel -cp:p /path/to/nimrodlf.jar

Quaqua: --laf ch.randelshofer.quaqua.QuaquaLookAndFeel -cp:p /path/to/quaqua.jar

If you find a nice L&F, write me, I will add the screenshot here.

Category: Tips & Tricks | Permalink | Comments [21]

Trackback URL: http://blogs.sun.com/netbeansphp/entry/how_to_change_look_and
Comments:

Thanks for the post!

Posted by Amit on December 03, 2008 at 12:37 PM CET #

HALLELUJAH!!!!

You just solved issue #1 of 2 MAJOR issues for me.

If you can tell me how to get the double-click for selecting a word to work on Mouse-Down as opposed to Mouse-Up, you'll officially have made my life a WHOLE lot easier and more enjoyable (with regards to NetBeans of course).

Posted by James on December 03, 2008 at 02:24 PM CET #

If think is so complicate to remember com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel you can put the shortcut "Nimbus", like this: netbeans --laf Nimbus

Source: http://blogs.sun.com/coreqa/entry/short_look_feel_switches_for

Posted by Giuliano on December 03, 2008 at 02:34 PM CET #

I always ask myself: "Is it so difficult to put an option in the "option menu"??" Simple drop down menu - nothing fancy.

Posted by Daniel Dimitrov on December 03, 2008 at 02:48 PM CET #

Hi Petr,

*THANKS* for this tip. I really do not like the L&F of the Mac OS version (default Quaqua), so I now know how to switch it to MetalLookAndFeel, which so much better for me.

Posted by Jan Brucek on December 03, 2008 at 02:49 PM CET #

I second @James comment, the focus issue was killing me, the Metal l&f is much better. Word select on dbl-click-mouseup is a pita too though, it needs to be on dbl-click-mousedown. Searching netbeans suggests DefaultEditorKit.java is responsible - any Swing gurus have a suggestion?

Posted by Demian Turner on December 03, 2008 at 04:23 PM CET #

To James: Regarding the doubleclick - the current behavior is unfortunately hardcoded. So I entered new issue http://www.netbeans.org/issues/show_bug.cgi?id=154505 . Feel free to add your comment there and I hope that it will be fixed soon.

To Daniel: There was such option in the ui for selecting L&F, but it was few years ago. NetBeans are not simple Swing application and it uses some costume components, which doesn't have to work with some L&F correctly. Probably the reason for removing the option as well was, that is not possible to provide preview without restarting. And the last think is, how often do you change it?

Regards,
Petr

Posted by Petr on December 03, 2008 at 05:37 PM CET #

thank for the info,

any chance windows L&F focus bug will be fixed ?

regard

Anton

Posted by Anton Heryanto on December 03, 2008 at 06:25 PM CET #

Hi Anton,

the Windows L&F is in JDK and it looks like it has long history. I don't have idea, when it can be fixed. When I went through the bug reports, then I had feeling, that it was already fixed, but after a while it appears again.

Regards,
Petr

Posted by Petr on December 03, 2008 at 07:00 PM CET #

One on the most attractive for me is Substance Look & Feel...

https://substance.dev.java.net/see.html

Posted by Martin Skurla on December 03, 2008 at 07:18 PM CET #

Thanks for logging the ticket Petr. I would LOVE for this "issue" to be resolved.

Posted by James on December 04, 2008 at 01:22 AM CET #

Thank Petr for this info.
I'm using Windows, and this tips really helps.

Posted by Yudi Setiawan on December 04, 2008 at 04:42 AM CET #

Hi All:

I am trying to change the skin of my NB6.5.

This is my environment on ubuntu 8.1
java -version
java version "1.6.0_0"
IcedTea6 1.3.1 (6b12-0ubuntu6) Runtime Environment (build 1.6.0_0-b12)
OpenJDK 64-Bit Server VM (build 1.6.0_0-b12, mixed mode)

If I try to run /usr/local/netbean6.5/bin/netbean --laf com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel

I get "uI class not found, using default UI..."

1. Where can I download some of these themes mentioned above?
2. Do they work with OpenJDK or I need to switch to SUNJDK ?

Posted by Toma on December 09, 2008 at 02:38 AM CET #

Hi Toma,

I was writing about SUN JDK. For Nimbus theme I should install SUN JDK 1.6.0_10, which is update 10.

Regards,
Petr

Posted by Petr on December 09, 2008 at 10:21 AM CET #

Hi Petr:

I am still trying to change L&F of netbean without any success.

tom@sony:~$ java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)

I switched to sun JDK on my Ubuntu 8.1 64bit: As u can see above. Using the command line you mentioned above I get the following output

./netbeans --laf com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
UI class not found, using default UI...
UI class not found, using default UI...
/usr/share/themes/EdubuntuColors/gtk-2.0/gtkrc:77: Murrine configuration option "hilight_ratio" will be deprecated in future releases. Please update this theme to get rid of this warning.

Any ideas guys ? Sorry if this is not the place to ask this question.

Posted by Toma on December 11, 2008 at 08:39 AM CET #

Hi Petr:

BY the way, latest build of NB from trunk with Nimbus worked on the same configuration as i reported on previous post. I am happy with result, so no worries about 6.5FCS, Nightly builds are good enough for me.

Regards

Posted by Toma on December 11, 2008 at 10:43 AM CET #

To Toma,

this is strange. It should work for NB 6.5 as well.

I have Ubuntu as well and my current version of java is:

Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b25)
Java HotSpot(TM) Server VM (build 11.0-b12, mixed mode)

Petr

Posted by Petr on December 11, 2008 at 11:23 PM CET #

Nice post! Thanks!

Posted by eldo on December 15, 2008 at 10:36 PM CET #

Thank You

Posted by Emo Resimleri on May 01, 2009 at 05:59 PM CEST #

the Windows L&F is in JDK and it looks like it has long history. I don't have idea, when it can be fixed. When I went through the bug reports, then I had feeling, that it was already fixed, but after a while it appears again.

Posted by dvd film izle on June 09, 2009 at 07:15 PM CEST #

It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.

Posted by links of london on October 31, 2009 at 03:34 AM CET #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed