@@ -0,0 +1,2007 @@
+package com.alexrnl.commons.gui.swing;%0A%0Aimport java.awt.Frame;%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;%0A%0Aimport javax.swing.SwingUtilities;%0Aimport javax.swing.UIManager;%0Aimport javax.swing.UIManager.LookAndFeelInfo;%0Aimport javax.swing.UnsupportedLookAndFeelException;%0A%0Aimport com.alexrnl.commons.error.ExceptionUtils;%0A%0A/**%0A * TODO%0A * @author Alex%0A */%0Apublic final class SwingUtils %7B%0A%09/** Logger */%0A%09private static Logger%09lg%09= Logger.getLogger(SwingUtils.class.getName());%0A%09%0A%09/**%0A%09 * Constructor #1.%3Cbr /%3E%0A%09 * Default private constructor.%0A%09 */%0A%09private SwingUtils () %7B%0A%09%09super();%0A%09%7D%0A%09%0A%09/**%0A%09 * Sets the look and feel of the application.%3Cbr /%3E%0A%09 * Update all frames and pack them to update%0A%09 * @param lookAndFeelName%0A%09 *        the name of the look and feel to set.%0A%09 * @return %3Ccode%3Etrue%3C/code%3E if the new look and feel was successfully set.%0A%09 */%0A%09public static boolean setLookAndFeel (final String lookAndFeelName) %7B%0A%09%09boolean lookAndFeelApplied = false;%0A%09%09for (final LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) %7B%0A%09%09%09if (lg.isLoggable(Level.FINE)) %7B%0A%09%09%09%09lg.fine(laf.getName());%0A%09%09%09%7D%0A%09%09%09if (laf.getName().equals(lookAndFeelName)) %7B%0A%09%09%09%09try %7B%0A%09%09%09%09%09UIManager.setLookAndFeel(laf.getClassName());%0A%09%09%09%09%09if (lg.isLoggable(Level.FINE)) %7B%0A%09%09%09%09%09%09lg.fine(%22Look and feel properly setted (%22 + laf.getName() + %22).%22);%0A%09%09%09%09%09%7D%0A%09%09%09%09%09lookAndFeelApplied = true;%0A%09%09%09%09%7D catch (ClassNotFoundException %7C InstantiationException %7C IllegalAccessException%0A%09%09%09%09%09%09%7C UnsupportedLookAndFeelException e) %7B%0A%09%09%09%09%09lg.warning(%22Could not set the look and feel %22 + laf.getName() + %22: %22%0A%09%09%09%09%09%09+ ExceptionUtils.display(e));%0A%09%09%09%09%09lookAndFeelApplied = false;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09// Applying changes to application%0A%09%09if (lookAndFeelApplied) %7B%0A%09%09%09for (final Frame frame : Frame.getFrames()) %7B%0A%09%09%09%09SwingUtilities.updateComponentTreeUI(frame);%0A%09%09%09%7D%0A%09%09%7D else %7B%0A%09%09%09lg.warning(%22Could not find (or set) the look and feel %22 + lookAndFeelName%0A%09%09%09%09%09+ %22. Using default look and feel.%22);%0A%09%09%7D%0A%09%09return lookAndFeelApplied;%0A%09%7D%0A%7D%0A

Add SwingUtils class, with a method for changing the look and feel