views:

229

answers:

2

I am working with NetBeans 6.5 IDE and i have downloaded a look and feel jar file. I added that to NetBeans by palette manager but i don't know how to use it to my application using code. Anybody please tell me that how to add look and feel into my application? Thanks..

+1  A: 

You can follow this Sun tutorial about setting the L&F in Java

You can change the L&F with setLookAndFeel even after the program's GUI is visible.
To make existing components reflect the new L&F, invoke the SwingUtilities updateComponentTreeUI method once per top-level container.
Then you might wish to resize each top-level container to reflect the new sizes of its contained components. For example:

UIManager.setLookAndFeel(lnfName);
SwingUtilities.updateComponentTreeUI(frame);
frame.pack();
VonC
Thanks for your reply. How to get InfName for a look and feel. We have windows classic ( I am using windows OS) theme in NetBeans. whats the InfName for that.
Samurai
A: 

Thanks for your reply. By using the below code we can get all look and feel class names.

UIManager.LookAndFeelInfo[] lookAndFeelInfos = UIManager.getInstalledLookAndFeels();
    for (int i = 0; i < lookAndFeelInfos.length; i++) {
        UIManager.LookAndFeelInfo lookAndFeelInfo = lookAndFeelInfos[i];

        //
        // Get the name of the look and feel
        //
        String name = lookAndFeelInfo.getName();
        System.out.println("name = " + name);

        //
        // Get the implementation class for the look and feel
        //
        String className = lookAndFeelInfo.getClassName();
        System.out.println("className = " + className);
    }
Samurai
This will display the all installed look and feels.
Samurai