Java Swing Look and Feel setLookAndFeel(Component comp)

Here you can find the source of setLookAndFeel(Component comp)

Description

set Look And Feel

License

Open Source License

Declaration

private static void setLookAndFeel(Component comp) throws Exception 

Method Source Code


//package com.java2s;
/*/*w  w w .  java 2  s  .  c o  m*/
 * Beanfabrics Framework Copyright (C) by Michael Karneim, beanfabrics.org
 * Use is subject to license terms. See license.txt.
 */

import java.awt.Component;

import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class Main {
    private static void setLookAndFeel(Component comp) throws Exception {
        if (isInEclipse()) {
            LookAndFeel oldLaF = UIManager.getLookAndFeel();
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            SwingUtilities.updateComponentTreeUI(comp);
            UIManager.setLookAndFeel(oldLaF);
        }
    }

    private static boolean isInEclipse() {
        try {
            Class.forName("org.eclipse.core.runtime.Platform");
            return true;
        } catch (Exception ex) {
            return false;
        }
    }
}

Related

  1. setLookAndFeel()
  2. setLookAndFeel()
  3. setLookAndFeel()
  4. setLookAndFeel()
  5. setLookAndFeel()
  6. setLookAndFeel(Component comp, LookAndFeel lf)
  7. setLookAndFeel(final Class lookAndFeel)
  8. setLookAndFeel(String laf)
  9. setLookAndFeel(String lafName)