+ /**
+ * Tries to load the class with the given name and includes the look & feel
+ * in the UIManager, if it exists.
+ *
+ * @param name
+ * The name of the look & feel
+ * @param className
+ * The name of the look & feel’s main class
+ */
+ @SuppressWarnings("unused")
+ private void addLookAndFeel(String name, String className) {
+ addLookAndFeels(new LookAndFeelInfo(name, className));
+ }
+
+ /**
+ * Tries to load each look & feel and adds it to the list of installed look &
+ * feels.
+ *
+ * @see UIManager#setInstalledLookAndFeels(LookAndFeelInfo[])
+ * @param lookAndFeelInfos
+ * The look & feels to add
+ */
+ private void addLookAndFeels(LookAndFeelInfo... lookAndFeelInfos) {
+ List<LookAndFeelInfo> allLookAndFeelInfos = new ArrayList<LookAndFeelInfo>(Arrays.asList(UIManager.getInstalledLookAndFeels()));
+ for (LookAndFeelInfo lookAndFeelInfo: lookAndFeelInfos) {
+ try {
+ Class.forName(lookAndFeelInfo.getClassName());
+ allLookAndFeelInfos.add(lookAndFeelInfo);
+ } catch (ClassNotFoundException e) {
+ /* okay, it doesn't exist, ignore. */
+ }
+ }
+ UIManager.setInstalledLookAndFeels(allLookAndFeelInfos.toArray(new LookAndFeelInfo[0]));
+ }
+