Native looking Netbeans on Linux

It’s all very fine and well those Windows people having a nice native Look & Feel under Netbeans, but what about us lowly Linux types? Well as many already know, Sun implemented a GTK Look & Feel around the 1.5 release, but the Metal Look & Feel is still the default on a Linux system, even at 1.6. The new GTK Look & Feel actually uses GTK widgets underneath, so will emulate the GTK Look & Feel very closely (although I’ve come across a few minor issues with scrollbars).

So how do you invoke Netbeans with the GTK Look & Feel? It’s documented in the Netbeans documentation:

Instead of simply invoking the /bin/netbeans executable, invoke:

/opt/netbeans/bin/netbeans -laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel

Substitue /opt/netbeans for wherever you installed Netbeans to.

Hint: You can open your “/opt/netbeans/etc/netbeans.conf” file, and add the “-laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel” to the end of the “netbeans_default_options” variable.

This is all very fine and well for GNOME people, but what about the KDE users out there? The answer comes in the form of the QT Engine for GTK. It makes GTK applications use QT for their rendering (installed by default in SUSE).

nebeans-serenity.jpg Finally, heres a screen shot of Netbeans running with the Serenity Look & Feel (under KDE). I know it doesn’t look great, but it illustrates the idea anyway ๐Ÿ˜‰ Click the image for the full view.

16 Responses to “Native looking Netbeans on Linux”

  1. Anon Says:

    Thanks for those tips. On ubuntu linux, the conf file to edit is:
    /etc/netbeans5.5/netbeans.conf
    At least for version 5.5. Thanks again!

  2. Amit Says:

    Hi
    I am Amit, NetBeans Community Docs co-ordinator. Your tip would make a good entry for the NetBeans Community Docs. Would you kindly contribute it there? Or I can do that for you. Just let me know!

    Looking forward to hear from you!

    Thanks

  3. Parminder Says:

    Just downloaded Netbeans 6.0 and it turns out that the look and feel option has been changed from -laf to –laf everything else remains the same.

  4. Parminder Says:

    Well the previous post did not work properly ๐Ÿ™‚

    Its laf with a double hyphen (long format notation), so – – laf

  5. Hugo Says:

    Hi,

    Thanks for the tip, it works, but the fonts of the IDE become smaller and without anti-alising, they are very ugly. Any hints to use my default KDE fonts?

  6. Ali Akbar Says:

    In netbeans 6.0.1, it’s --laf, not -laf

  7. Ross Peoples Says:

    For all the Ubuntu people out there, I couldn’t find the conf file anywhere. However, I found a better way to do it.

    Right-click on the Applications menu -> Edit Menus.
    Find the NetBeans application and right-click on it -> Properties
    Replace the Command with this:
    /usr/bin/netbeans –laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel

  8. Ross Peoples Says:

    For some reason the comment had the extra dash (-) taken out. The “-laf” is supposed to have two dashes in front it, not just one, as others above have mentioned.

  9. jjoshi Says:

    thanks that helps. for me the look and feel changed from native to the metal when i switched from gnome to xfce on ubuntu but adding the option in conf file fixed it.

  10. Le Dinh Tuan Says:

    Thanks, this’s very helpful .

  11. santosh Says:

    Hey,
    thanks a lot!!
    I really hate jdk look of any java applications.

    once again thanks.

    • Jason Says:

      I would strongly advise changing your default Look And Feel to Nimbus. Edit (or create) you swing.properties file: <JRE_HOME>/lib/swing.properties
      Add the line:
      swing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel

      This will make all your Swing apps look a hell of a lot better. Won’t be native look and feel, but it’s what I’m running and I’m wishing that KDE had a Nimbus LAF ๐Ÿ˜‰

  12. Can I make Ubuntu 11.10's desktop look like 11.04's Ubuntu Classic? Says:

    […] You’ll notice NetBeans looks ugly in Xfce (compared to Unity/Ubuntu). To fix that, add –laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel to any and all launchers for NetBeans. For some reason, NetBeans on Unity loads the GTK Look and Feel, whereas under Xfce it loads a “Metal” Look and feel. Solution found here. […]

  13. Minty Stark Says:

    Thank you so much.
    I have a Dark theme for xfce and didn’t like the metal theme.
    This worked for me using 7.2
    I added “–laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel” to my netbeans.conf file.
    which was located here: /usr/local/netbeans-7.2/etc/netbeans.conf
    I added at the end of the netbeans_default_options variable and seperated it with a space before the “–laf”

    Your config file location will vary. You can locate it by typing this command in your terminal:
    locate netbeans.conf

  14. Can I make Ubuntu 11.10's desktop look like 11.04's Ubuntu Classic? - Boot Panic Says:

    […] You’ll notice NetBeans looks ugly in Xfce (compared to Unity/Ubuntu). To fix that, add –laf com.sun.java.swing.plaf.gtk.GTKLookAndFeel to any and all launchers for NetBeans. For some reason, NetBeans on Unity loads the GTK Look and Feel, whereas under Xfce it loads a “Metal” Look and feel. Solution found here. […]

  15. Ubuntu 11.10์˜ ๋ฐ์Šคํฌํƒ‘์„ 11.04์˜ Ubuntu Classic์ฒ˜๋Ÿผ ๋ณด์ด๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ? ๋ฉ”๋‰ด ๋ฐ ์ด์ „ ์ž‘์—… ๊ณต๊ฐ„ ๋ ˆ์ด์•„์›ƒ์„ - IT HOW Says:

    […] GTK ๋ฃฉ์•คํ•„์„๋กœ๋“œํ•˜๋Š” ๋ฐ˜๋ฉด Xfce์—์„œ๋Š” “๋ฉ”ํƒˆ”๋ฃฉ์•คํ•„์„๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค. ํ•ด๊ฒฐ์ฑ…์€ ์—ฌ๊ธฐ์— ์žˆ์Šต๋‹ˆ๋‹ค […]


Leave a comment