⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compierelookandfeel.java

📁 Java写的ERP系统
💻 JAVA
字号:
/******************************************************************************
 * The contents of this file are subject to the   Compiere License  Version 1.1
 * ("License"); You may not use this file except in compliance with the License
 * You may obtain a copy of the License at http://www.compiere.org/license.html
 * 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 Original Code is                  Compiere  ERP & CRM  Business Solution
 * The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc.
 * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
 * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
 * Contributor(s): ______________________________________.
 *****************************************************************************/
package org.compiere.plaf;

import javax.swing.plaf.metal.*;
import javax.swing.*;
import java.awt.*;
import java.util.*;

/**
 *  Compiere Look & Feel.
 *  We wanted a nice UI not the battleship gray based stuff.
 *  I guess a matter of taste.
 *  <code>
 *  :
 *  UIManager.setLookAndFeel(new com.compiere.plaf.CompiereLookAndFeel());
 *  // or UIManager.setLookAndFeel("com.compiere.plaf.CompiereLookAndFeel");
 *  </code>
 *
 *  @author     Jorg Janke
 *  @version    $Id: CompiereLookAndFeel.java,v 1.10 2002/08/12 01:55:15 danb Exp $
 */
public class CompiereLookAndFeel extends MetalLookAndFeel
{
	/**
	 *  Constructor
	 */
	public CompiereLookAndFeel()
	{
		super();
	//	System.setProperty("awt.visualbell", "true");
	}   //  CompiereLookAndFeel

	/** The name                    */
	public static final     String  NAME = "Compiere";

	/** The Theme                   */
	private static          CompiereTheme   s_compiereTheme = new CompiereTheme();
	private static          MetalTheme      s_theme = s_compiereTheme;

	/** Paint Round Corners         */
	protected static boolean ROUND = false;

	/**
	 *  The Name
	 *  @return Name
	 */
	public String getName()
	{
		return NAME;
	}   //  getName

	/**
	 *  The ID
	 *  @return Name
	 */
	public String getID()
	{
		return NAME;
	}   //  getID

	/**
	 *  The Description
	 *  @return description
	 */
	public String getDescription()
	{
		return "Compiere Look & Feel - (c) 2001 Jorg Janke";
	}   //  getDescription

	/*************************************************************************/

	/**
	 *  Get/Create Defaults
	 *  @return UI Defaults
	 */
	public UIDefaults getDefaults()
	{
	//	System.out.println("CompiereLookAndFeel.getDefaults");
		//  Theme already created/set
		MetalLookAndFeel.setCurrentTheme(s_theme);
		UIDefaults defaults = super.getDefaults();  // calls init..Defaults
		return defaults;
	}   //  getDefaults

	/**
	 * Creates the mapping from UI class IDs to <code>ComponentUI</code> classes,
	 * putting the ID-<code>ComponentUI</code> pairs in the passed-in defaults table.
	 * Each <code>JComponent</code> class specifies its own UI class ID string.
	 *
	 * @param table UI Defaults
	 */
	protected void initClassDefaults(UIDefaults table)
	{
	//	System.out.println("CompiereLookAndFeel.initClassDefaults");
		super.initClassDefaults( table);
		//  Overwrite
		putDefault (table, "PanelUI");
		putDefault (table, "ButtonUI");
		putDefault (table, "ToggleButtonUI");
		putDefault (table, "TabbedPaneUI");
		putDefault (table, "TableHeaderUI");
		putDefault (table, "RadioButtonUI");
		putDefault (table, "CheckBoxUI");
		putDefault (table, "ComboBoxUI");
		putDefault (table, "MenuUI");
		putDefault (table, "MenuBarUI");
		putDefault (table, "ToolBarUI");
		putDefault (table, "RootPaneUI");
		putDefault (table, "ViewportUI");
		putDefault (table, "SplitPaneUI");
		putDefault (table, "ScrollPaneUI");



		/**
		 *  CheckBoxMenuItemUI=javax.swing.plaf.basic.BasicCheckBoxMenuItemUI
		 *  CheckBoxUI=javax.swing.plaf.metal.MetalCheckBoxUI
		 *  ColorChooserUI=javax.swing.plaf.basic.BasicColorChooserUI
		 *  DesktopIconUI=javax.swing.plaf.metal.MetalDesktopIconUI
		 *  DesktopPaneUI=javax.swing.plaf.basic.BasicDesktopPaneUI
		 *  EditorPaneUI=javax.swing.plaf.basic.BasicEditorPaneUI
		 *  FileChooserUI=javax.swing.plaf.metal.MetalFileChooserUI
		 *  FormattedTextFieldUI=javax.swing.plaf.basic.BasicFormattedTextFieldUI
		 *  InternalFrameUI=javax.swing.plaf.metal.MetalInternalFrameUI
		 *  LabelUI=javax.swing.plaf.metal.MetalLabelUI
		 *  ListUI=javax.swing.plaf.basic.BasicListUI
		 *  MenuItemUI=javax.swing.plaf.basic.BasicMenuItemUI
		 *  MenuUI=javax.swing.plaf.basic.BasicMenuUI
		 *  OptionPaneUI=javax.swing.plaf.basic.BasicOptionPaneUI
		 *  PasswordFieldUI=javax.swing.plaf.basic.BasicPasswordFieldUI
		 *  PopupMenuSeparatorUI=javax.swing.plaf.metal.MetalPopupMenuSeparatorUI
		 *  PopupMenuUI=javax.swing.plaf.basic.BasicPopupMenuUI
		 *  ProgressBarUI=javax.swing.plaf.metal.MetalProgressBarUI
		 *  RadioButtonMenuItemUI=javax.swing.plaf.basic.BasicRadioButtonMenuItemUI
		 *  ScrollBarUI=javax.swing.plaf.metal.MetalScrollBarUI
		 *  ScrollPaneUI=javax.swing.plaf.metal.MetalScrollPaneUI
		 *  SeparatorUI=javax.swing.plaf.metal.MetalSeparatorUI
		 *  SliderUI=javax.swing.plaf.metal.MetalSliderUI
		 *  SpinnerUI=javax.swing.plaf.basic.BasicSpinnerUI
		 *  TableUI=javax.swing.plaf.basic.BasicTableUI
		 *  TextAreaUI=javax.swing.plaf.basic.BasicTextAreaUI
		 *  TextFieldUI=javax.swing.plaf.metal.MetalTextFieldUI
		 *  TextPaneUI=javax.swing.plaf.basic.BasicTextPaneUI
		 *  ToolBarSeparatorUI=javax.swing.plaf.basic.BasicToolBarSeparatorUI
		 *  ToolTipUI=javax.swing.plaf.metal.MetalToolTipUI
		 *  TreeUI=javax.swing.plaf.metal.MetalTreeUI
		 */
	}   //  initClassDefaaults

	/**
	 *  Put "uiKey - ClassName" pair in UIDefaults
	 *  @param table
	 *  @param uiKey
	 */
	private void putDefault (UIDefaults table, String uiKey)
	{
		try
		{
			String className = "org.compiere.plaf.Compiere" + uiKey;
			table.put(uiKey, className);
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}   //  putDefault

	/**
	 *  For overwriting Component defaults
	 *  @param table
	 */
	protected void initSystemColorDefaults (UIDefaults table)
	{
	//	System.out.println("CompiereLookAndFeel.initSystemColorDefaults");
		super.initSystemColorDefaults( table);

		// we made the color a bit darker
	//	table.put("textHighlight", CompiereUtils.getTranslucentColor(getTextHighlightColor(), 128));
	}   //  initSystemColorDefaults

	/**
	 *  For overwriting Component defaults
	 *  @param table
	 */
	protected void initComponentDefaults (UIDefaults table)
	{
	//	System.out.println("CompiereLookAndFeel.initComponentDefaults");
		super.initComponentDefaults( table);

		//  ComboBox defaults
		Color c = table.getColor("TextField.background");
		table.put("ComboBox.background", c);
		table.put("ComboBox.listBackground", c);
	}   //  initComponentDefaults

	/*************************************************************************/

	/**
	 *  Create Default Thems
	 */
	protected void createDefaultTheme()
	{
		setCurrentTheme(s_theme);
	}   //  createDefaultTheme

	/**
	 *  Set Current Theme
	 *  @param theme metal theme
	 */
	public static void setCurrentTheme (MetalTheme theme)
	{
		if (theme != null)
			s_theme = theme;
		MetalLookAndFeel.setCurrentTheme(s_theme);
	}   //  setCurrentTheme

	/**
	 *  Get Current Theme
	 *  @return Metal Theme
	 */
	public static MetalTheme getCurrentTheme()
	{
		return s_theme;
	}   //  getCurrentTheme

	/**
	 *  Get Compiere Theme
	 *  @return Metal Theme
	 */
	public static CompiereTheme getCompiereTheme()
	{
		return s_compiereTheme;
	}   //  getCurrentTheme

	/**
	 *  Error Feedback.
	 *  <p>
	 *  Invoked when the user attempts an invalid operation,
	 *  such as pasting into an uneditable <code>JTextField</code>
	 *  that has focus.
	 *  </p>
	 *  <p>
	 *  If the user has enabled visual error indication on
	 *  the desktop, this method will flash the caption bar
	 *  of the active window. The user can also set the
	 *  property awt.visualbell=true to achieve the same
	 *  results.
	 *  </p>
	 *  @param component Component the error occured in, may be
	 *			null indicating the error condition is
	 *			not directly associated with a
	 *			<code>Component</code>.
	 */
	public void provideErrorFeedback (Component component)
	{
		super.provideErrorFeedback (component);
	}   //  provideErrorFeedback

}   //  CompiereLookAndFeel

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -