How to change look & feel of NetBeans IDE and application

NetBeans IDE or NetBeans Platform app

  1. In NetBeans IDE installation directory
    • under Ubuntu it’s /home/libor/dev/netbeans/
    • under Windows it’s C:\Program Files\NetBeans\
  1. Find etc directory and netbeans.conf file
  1. Add to the end of line beginning with netbeans_default_options parameter
—laf path.to.your.laf

e.g. --laf javax.swing.plaf.nimbus.NimbusLookAndFeel

On my Ubuntu 11.10 and Oracle JDK 7 I have available:

javax.swing.plaf.metal.MetalLookAndFeel
javax.swing.plaf.nimbus.NimbusLookAndFeel
com.sun.java.swing.plaf.motif.MotifLookAndFeel
com.sun.java.swing.plaf.gtk.GTKLookAndFeel

Please note that GTKLookAndFeel is not available in Windows.

  • --laf Nimbus for Nimbus L&F
  • --laf javax.swing.plaf.metal.MetalLookAndFeel for Metal L&F
  • --laf Gtk for Metal L&F
  • --laf path.to.your.laf for any other L&F

Notice that I am using fully qualified class with package name or just class. If class is available to NetBeans launcher script (JDK standard LAFs), you can abbreviate to class name.

So complete line can looks like this (text wrapped for better legibility):

netbeans_default_options=”-J-client -J-Xss2m -J-Xms32m 
-J-XX:PermSize=32m -J-XX:MaxPermSize=384m 
-J-Dapple.laf.useScreenMenuBar=true 
-J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true 
-J-DuseSystemAAFontSettings=lcd -J-Dswing.aatext=true —laf Gtk”

NetBeans Platform apps

If you want the same for your NetBeans Platform application add to project (suite) project.properties file this line:

run.args.extra=—laf Nimbus

About Libor Jelinek

Enthusiastic Eclipse, OSGi and Java desktop programmer, happy Ubuntu Linux user, early adopter and open source believer. He's living in small town near to Prague (Czech Republic) and splitting free time among yoga, vegetarian cooking and dog. See more.

7 thoughts on “How to change look & feel of NetBeans IDE and application

  • like says on January 12, 2012, 4:14 pm | Reply

    Hello and thanks, this was helpful but I have a question.
    After I used MetalLookAndFeel for my NetBeans Platform app and ran the app from the IDE it worked fine, but when I Package as Installer and run the Windows Installer, the app switched back to the default l&f.
    I guess there is a library or module I need to include with my app for the MetalLookAndFeel?

    • Libor Jelinek says on January 12, 2012, 4:21 pm | Reply

      I guess you to check content of etc/yourAppName.conf in final packaged application. Variable yourAppName_default_options should contains “–laf MetalLookAndFeel”.

  • like says on January 12, 2012, 4:51 pm | Reply

    I just want to send the users of my app the installer. It sounds like each user would have to change the yourAppName_default_options?
    Thanks for your help.

    • Libor Jelinek says on January 13, 2012, 9:36 am | Reply

      No it’s little different. Let’s explain it in NetBeans IDE but it also fully apply to own applications. netbeans.conf with netbeans_default_options is only once per computer. Depeneds where you’ve installed NB IDE. If it is /opt/NetBeans-7.1, then file is at /opt/NetBeans-7.1/etc/netbeans.conf.

      Thanks for interesting link! Good to know that there is still just one another way of doing same.

  • like says on January 12, 2012, 9:01 pm | Reply

    I found a post that uses a another way to set the L&F and it worked with the Netbeans Platform Installer… http://joshiegeek.blogspot.com/2012/01/netbeans-platform-custom-laf.html
    – thanks, your post was also helpful!
    ps: interesting thing, is that using the other there were many subtle changes to the Metal L&F

  • Ashish K Yadav says on November 9, 2012, 6:11 am | Reply

    Thanks simple and effective way.

  • Ashish K Yadav says on November 9, 2012, 6:27 am | Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

In an effort to prevent automatic filling, you should perform a task displayed below.