Change Netbeans preview from an external LookAndFeel

I downloaded 4 LookAndFeel(LAF) libraries and one of them is SeaGlass LAF for java GUI, so far I managed to use them by writing this line:

UIManager.setLookAndFeel(new SeaGlassLookAndFeel());

but while I'm desinging I have to see what I'm building in the default Metal LAF in Netbeans, so the only way for me to see the real result is by running the application. I know there's a way to change JFrame Preview design, and I know how to do it, but I don't know how can I add my LAF libraries to this list Netbeans provides. So I will really appreciate an answer.. I've looked everywhere, I know there's another guy who talks about something like this in another post but I couldn't found the answer there.

Upvotes: 0

Views: 270

Answers (1)

rhitz
rhitz

Reputation: 1892

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\

  2. Find etc directory and netbeans.conf file

  3. 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

Source : How to change look & feel of Netbeans IDE & Application

Upvotes: 2

Related Questions