ConfigLnF.java :  » Content-Management-System » harmonise » org » openharmonise » him » configuration » lnf » Java Open Source

Java Open Source » Content Management System » harmonise 
harmonise » org » openharmonise » him » configuration » lnf » ConfigLnF.java
/*
 * The contents of this file are subject to the 
 * Mozilla Public License Version 1.1 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
 * See the License for the specific language governing rights and 
 * limitations under the License.
 *
 * The Initial Developer of the Original Code is Simulacra Media Ltd.
 * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
 *
 * All Rights Reserved.
 *
 * Contributor(s):
 */
package org.openharmonise.him.configuration.lnf;

import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import org.openharmonise.him.configuration.*;
import org.openharmonise.him.window.*;


/**
 * Class to represent Java Look and Feel options.
 * 
 * @author Matthew Large
 * @version $Revision: 1.1 $
 *
 */
public class ConfigLnF {

  /**
   * Configuration dialog.
   */
  private ConfigDialog m_dialog = null;

  /**
   * 
   */
  protected ConfigLnF() {
  }

  /**
   * Classname of Java Look and Feel.
   */
  private String m_sClassName = null;

  /**
   * Constructs a new look and feel option.
   * 
   * @param sClassName Classname of Java Look and Feel
   * @param dialog onfiguration dialog
   */
  public ConfigLnF(String sClassName, ConfigDialog dialog) {
    super();
    this.m_dialog = dialog;
    this.m_sClassName = sClassName;
  }
  
  /**
   * Sets the Content Manager look and feel to this option.
   *
   */
  public void setLookAndFeel() {
    try {
      UIManager.setLookAndFeel(m_sClassName);
      SwingUtilities.updateComponentTreeUI(DisplayManager.getInstance().getMainWindow());
      SwingUtilities.updateComponentTreeUI(this.m_dialog);
    } catch (ClassNotFoundException e) {
      e.printStackTrace();
    } catch (InstantiationException e) {
      e.printStackTrace();
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace();
    }
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.