JEphem Informatic Trail tig source code SwingUtils.java
//*********************************************************************************
// class tig.swing.SwingUtils
// Software released under the General Public License (version 2 or later), available at
// http://www.gnu.org/copyleft/gpl.html
//*********************************************************************************
package tig.swing;

import javax.swing.*;
/**********************************************************************************
Class containing useful static methods and constants for Swing development.
@author Thierry Graff
@history mar 01 2002 : Creation.
**********************************************************************************/
public abstract class SwingUtils{

  //=================================================================================
  //                                CONSTANTS
  //=================================================================================

  /** Constant to designate the default look and feel of the system. */
  public static final int LAF_SYSTEM = 0;
  /** Constant to designate the Kunststoff look and feel
  (coming from <A HREF="http://www.incors.org/" TARGET="_blank">http://www.incors.org/</A>). */
  public static final int LAF_KUNSTSTOFF = 1;
  /** Constant to designate the Macintosh look and feel. */
  public static final int LAF_MACINTOSH = 2;
  /** Constant to designate the Metal (cross platform) look and feel. */
  public static final int LAF_METAL = 3;
  /** Constant to designate the Motif look and feel. */
  public static final int LAF_MOTIF = 4;
  /** Constant to designate the Windows look and feel. */
  public static final int LAF_WINDOWS = 5;

  //=================================================================================
  //                                STATIC METHODS
  //=================================================================================

  //*****************************************************
  /** Sets the look and feel.
  @param laf The desired look and feel, using <CODE>LAF_XXX</CODE> constants of this class.
  @throws Exception If not possible
   */
  public static void setLookAndFeel(int laf) throws Exception{
    switch(laf){
      case LAF_SYSTEM :
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        break;
      case LAF_KUNSTSTOFF :
        UIManager.setLookAndFeel(new com.incors.plaf.kunststoff.KunststoffLookAndFeel());
        break;
      case LAF_MACINTOSH :
        UIManager.setLookAndFeel("javax.swing.plaf.mac.MacLookAndFeel");
        break;
      case LAF_METAL :
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        break;
      case LAF_MOTIF :
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
        break;
      case LAF_WINDOWS :
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        break;
    }// end switch
  }// end setLookAndFeel

}//end abstract class SwingUtils