1.0.0
[fanfix.git] / src / be / nikiroo / utils / UIUtils.java
CommitLineData
8caeb8bd
NR
1package be.nikiroo.utils;
2
3import javax.swing.UIManager;
4import javax.swing.UnsupportedLookAndFeelException;
5
6/**
7 * Some Java Swing utilities.
8 *
9 * @author niki
10 */
11public class UIUtils {
12 /**
13 * Set a fake "native look & feel" for the application if possible
14 * (check for the one currently in use, then try GTK).
15 * <p>
16 * <b>Must</b> be called prior to any GUI work.
17 */
18 static public void setLookAndFeel() {
19 // native look & feel
20 try {
21 String noLF = "javax.swing.plaf.metal.MetalLookAndFeel";
22 String lf = UIManager.getSystemLookAndFeelClassName();
23 if (lf.equals(noLF))
24 lf = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
25 UIManager.setLookAndFeel(lf);
26 } catch (InstantiationException e) {
27 } catch (ClassNotFoundException e) {
28 } catch (UnsupportedLookAndFeelException e) {
29 } catch (IllegalAccessException e) {
30 }
31 }
32}