Java Swing UIManager SetNetBeansCompatibleUIManager()

Here you can find the source of SetNetBeansCompatibleUIManager()

Description

Set the application look-and-feel to match NetBeans.

License

Open Source License

Return

true if look-and-feel is set, false otherwise

Declaration

public static boolean SetNetBeansCompatibleUIManager() 

Method Source Code

//package com.java2s;

import javax.swing.UIManager;

public class Main {
    /**/*from ww w .  java2  s .  c o m*/
     * Set the application look-and-feel to match NetBeans.
     * @return true if look-and-feel is set, false otherwise
     */
    public static boolean SetNetBeansCompatibleUIManager() {
        // set the LookAndFeel to match the IDE
        // reference: Robinson & Vorobiev p. 728
        UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels();
        // default installed LookAndFeels
        // updated for Java 1.6.0_11 2009-01-08
        // 0: javax.swing.plaf.metal.MetalLookAndFeel (default)
        // 1: com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel
        // 2: com.sun.java.swing.plaf.motif.MotifLookAndFeel
        // 3: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
        // 4: com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel
        int lafno = 3; // desired LookAndFeel for Windows XP to match NetBeans
        try {
            UIManager.setLookAndFeel(info[lafno].getClassName());
        } catch (Exception e) {
            System.err.println("Couldn't load " + info[lafno].getClassName() + " look and feel " + e);
            return false;
        }
        return true;
    }
}

Related

  1. setComponentLF(JComponent comp, String ui)
  2. setCrossPlatformProperties()
  3. setDefaultSize(int size)
  4. setEnabled(Component component, boolean enabled, boolean recursively)
  5. setNative()
  6. setNimbusLF()
  7. setSwingProperties(String appName)
  8. setSystemUi()
  9. setTheme()