Search code examples
javaswinglook-and-feel

Changing the default appearance of netbeans GUI controls


Hey I'm new to netbeans and I noticed a lot of applications (from textbooks) have a default style/appearance to their controls (buttons etc) as shown below.

Valid XHTML
(source: iforce.co.nz)
.

the appearance when I'm creating a GUI is just the standard windows xp or 7 button style. Is there a way to change this to the style shown in the image above?

Here is the appearance I am currently getting:

Valid XHTML
(source: iforce.co.nz)
.

Thanks in advance.


Solution

  • Yes, you can give Swing a Windows like look and feel with the following code:

    try{
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    }
    catch(Exception e){
            System.out.println("UIManager Exception : "+e);
    }