Here you can find the source of initLookAndFeel(final String className)
Parameter | Description |
---|---|
className | Full qualified name of the look and feel class. |
public static void initLookAndFeel(final String className)
//package com.java2s; /**/*from ww w . j a va 2s. c o m*/ * Copyright (C) 2009 Future Invent Informationsmanagement GmbH. All rights * reserved. <http://www.fuin.org/> * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 3 of the License, or (at your option) any * later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library. If not, see <http://www.gnu.org/licenses/>. */ import javax.swing.SwingUtilities; import javax.swing.UIManager; public class Main { /** * Initializes the look and feel and wraps exceptions into a runtime * exception. If this method is called outside the EDT it will switch * automatically to the UI thread using <code>invokeAndWait(Runnable)</code> * . * * @param className * Full qualified name of the look and feel class. */ public static void initLookAndFeel(final String className) { if (SwingUtilities.isEventDispatchThread()) { initLookAndFeelIntern(className); } else { try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { initLookAndFeelIntern(className); } }); } catch (final Exception ex) { throw new RuntimeException(ex); } } } /** * Initializes the look and feel and wraps exceptions into a runtime * exception. It's executed in the calling thread. * * @param className * Full qualified name of the look and feel class. */ private static void initLookAndFeelIntern(final String className) { try { UIManager.setLookAndFeel(className); } catch (final Exception e) { throw new RuntimeException("Error initializing the Look And Feel!", e); } } }