< prev index next >

## src/java.desktop/share/classes/javax/swing/UIManager.java

Print this page

     598         }
     599     }
     600
     601
     602     /**
     603      * Loads the {@code LookAndFeel} specified by the given class
     604      * name, using the current thread's context class loader, and
     605      * passes it to {@code setLookAndFeel(LookAndFeel)}.
     606      *
     607      * @param className  a string specifying the name of the class that implements
     608      *        the look and feel
     609      * @exception ClassNotFoundException if the <code>LookAndFeel</code>
     610      *           class could not be found
     611      * @exception InstantiationException if a new instance of the class
     612      *          couldn't be created
     613      * @exception IllegalAccessException if the class or initializer isn't accessible
     614      * @exception UnsupportedLookAndFeelException if
     615      *          <code>lnf.isSupportedLookAndFeel()</code> is false
     616      * @throws ClassCastException if {@code className} does not identify
     617      *         a class that extends {@code LookAndFeel}

     618      */
     619     @SuppressWarnings("deprecation")
     620     public static void setLookAndFeel(String className)
     621         throws ClassNotFoundException,
     622                InstantiationException,
     623                IllegalAccessException,
     624                UnsupportedLookAndFeelException
     625     {
     626         if ("javax.swing.plaf.metal.MetalLookAndFeel".equals(className)) {
     627             // Avoid reflection for the common case of metal.
     628             setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
     629         }
     630         else {
     631             Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
     632             setLookAndFeel((LookAndFeel)(lnfClass.newInstance()));
     633         }
     634     }
     635
     636     /**
     637      * Returns the name of the <code>LookAndFeel</code> class that implements
     598         }
     599     }
     600
     601
     602     /**
     603      * Loads the {@code LookAndFeel} specified by the given class
     604      * name, using the current thread's context class loader, and
     605      * passes it to {@code setLookAndFeel(LookAndFeel)}.
     606      *
     607      * @param className  a string specifying the name of the class that implements
     608      *        the look and feel
     609      * @exception ClassNotFoundException if the <code>LookAndFeel</code>
     610      *           class could not be found
     611      * @exception InstantiationException if a new instance of the class
     612      *          couldn't be created
     613      * @exception IllegalAccessException if the class or initializer isn't accessible
     614      * @exception UnsupportedLookAndFeelException if
     615      *          <code>lnf.isSupportedLookAndFeel()</code> is false
     616      * @throws ClassCastException if {@code className} does not identify
     617      *         a class that extends {@code LookAndFeel}
     618      * @throws NullPointerException if {@code className} is {@code null}
     619      */
     620     @SuppressWarnings("deprecation")
     621     public static void setLookAndFeel(String className)
     622         throws ClassNotFoundException,
     623                InstantiationException,
     624                IllegalAccessException,
     625                UnsupportedLookAndFeelException
     626     {
     627         if ("javax.swing.plaf.metal.MetalLookAndFeel".equals(className)) {
     628             // Avoid reflection for the common case of metal.
     629             setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
     630         }
     631         else {
     632             Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
     633             setLookAndFeel((LookAndFeel)(lnfClass.newInstance()));
     634         }
     635     }
     636
     637     /**
     638      * Returns the name of the <code>LookAndFeel</code> class that implements

< prev index next >