Here you can find the source of setLookAndFeel()
public static void setLookAndFeel()
//package com.java2s; /******************************************************************************* * //from w ww .j av a2 s . c o m * Copyright (C) 2010 Jalian Systems Private Ltd. * Copyright (C) 2010 Contributors to Marathon OSS Project * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Project website: http://www.marathontesting.com * Help: Marathon help forum @ http://groups.google.com/group/marathon-testing * *******************************************************************************/ import java.lang.reflect.Method; import javax.swing.UIManager; public class Main { /** * Sets the LAF for the application dynamically looking for JGoodies Looks * library. * */ public static void setLookAndFeel() { if (System.getProperty("java.vendor").startsWith("Apple")) { if (Boolean.getBoolean("marathon.useAppleMenuBar") || System.getProperty("marathon.useAppleMenuBar") == null) System.setProperty("apple.laf.useScreenMenuBar", "true"); return; } try { Class<?> classOptions = Class.forName("com.jgoodies.looks.Options"); Method method = classOptions.getMethod("setUseNarrowButtons", new Class[] { boolean.class }); method.invoke(null, new Object[] { Boolean.TRUE }); method = classOptions.getMethod("setUseSystemFonts", new Class[] { boolean.class }); method.invoke(null, new Object[] { Boolean.TRUE }); method = classOptions.getMethod("getCrossPlatformLookAndFeelClassName", new Class[] {}); String looksClass = (String) method.invoke(null, new Object[] {}); UIManager.setLookAndFeel(looksClass); } catch (Throwable e1) { // Do nothing - go ahead with the current Look and Feel } } }