I am using netbeans 7.0 in windows 7. The problem I am facing is that when we design any frame in GUI builder of netbeans then it uses Windows Look and Feel always, so i need to design according to that. So as long as I use windows look and feel in my projects it face no problem but when i switch theme then somethings get bigger or smaller which make the look of frame somewhat wierd.

Can anyone tell me how to switch that default design theme of netbeans to anything else like to nimbus?

Recommended Answers

All 3 Replies

you have to edit genetrated code and swith to the expected L&F or as you mentioned to the Nimbus Look and Feel

you have to edit genetrated code and swith to the expected L&F or as you mentioned to the Nimbus Look and Feel

kindly clarify a little more, what do you mean by I have to edit the generated code with expected look and feel.

I do not only want to change the look and feel of my program. I also want to change the look and feel while designing it in netbeans.

sorry I can't help you with that, since I "Netbeans User" (Eclispe too), I never ever used built-in Java DeskTop Aplication (or SWT/GWT too) before

looks like as not possible force this Look and Feel for Java DeskTop Aplication just as I tried and create a new Java DeskTop Aplication with naming for L&F or by setting swing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel (returns error),

you have to google for that

import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import javax.swing.UnsupportedLookAndFeelException;
import org.jdesktop.application.Application;
import org.jdesktop.application.SingleFrameApplication;

/**
 * The main class of the application.
 */
public class DesktopApplication1 extends SingleFrameApplication {

    /**
     * At startup create and show the main frame of the application.
     */
    @Override
    protected void startup() {
        show(new DesktopApplication1View(this));
    }

    /**
     * This method is to initialize the specified window by injecting resources.
     * Windows shown in our application come fully initialized from the GUI
     * builder, so this additional configuration is not needed.
     * @param root
     */
    @Override
    protected void configureWindow(java.awt.Window root) {
    }

    /**
     * A convenient static getter for the application instance.
     * @return the instance of DesktopApplication1
     */
    public static DesktopApplication1 getApplication() {
        return Application.getInstance(DesktopApplication1.class);
    }

    /**
     * Main method launching the application.
     * @param args
     */
    public static void main(String[] args) {
        try {
            for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                System.out.println(info.getName());
                if ("Nimbus".equals(info.getName())) {
                    UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (UnsupportedLookAndFeelException e) {
            // handle exception
        } catch (ClassNotFoundException e) {
            // handle exception
        } catch (InstantiationException e) {
            // handle exception
        } catch (IllegalAccessException e) {
            // handle exception
        }
        launch(DesktopApplication1.class, args);
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.