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

📄 compiereplafeditor.java

📁 Java写的ERP系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************
 * 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 java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.plaf.metal.*;
import java.util.*;
import sun.awt.AppContext;

import org.compiere.util.*;
import org.compiere.util.*;
import org.compiere.swing.*;

/**
 *  Compiere PLAF Editor.
 *  <p>
 *  start with <code>new CompierePLAFEditor()</code>
 *
 *  @author     Jorg Janke
 *  @version    $Id: CompierePLAFEditor.java,v 1.24 2002/04/28 00:36:10 jjanke Exp $
 */
public class CompierePLAFEditor extends JDialog
	implements ActionListener
{
	/**
	 *  Default Constructor
	 *  Don't Show Example
	 */
	public CompierePLAFEditor()
	{
		super();
		init(false);
	}   //  CompierePLAFEditor

	/**
	 *  Constructor
	 *  @param showExample if true, show Example
	 */
	public CompierePLAFEditor (boolean showExample)
	{
		super();
		init(showExample);
	}   //  CompierePLAFEditor

	/**
	 *  Modal Dialog Constructor
	 *  @param owner
	 *  @param showExample if true, show Example
	 */
	public CompierePLAFEditor(Dialog owner, boolean showExample)
	{
		super(owner, "", true);
		init(showExample);
	}   //  CompierePLAFEditor

	/**
	 *  Modal Frame Constructor
	 *  @param owner
	 *  @param showExample if true, show Example
	 */
	public CompierePLAFEditor(Frame owner, boolean showExample)
	{
		super(owner, "", true);
		init(showExample);
	}   //  CompierePLAFEditor

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

	/**
	 *  Init Editor
	 *  @param showExample if true, show Example
	 */
	private void init (boolean showExample)
	{
		try
		{
			jbInit();
			dynInit();

			//  Display
			example.setVisible(showExample);
			CompierePLAF.showCenterScreen(this);
		}
		catch(Exception e)
		{
			System.err.println("CompierePLAFEditor.init");
			e.printStackTrace();
		}
	//	CompiereUtils.setNotBuffered(this);
	}   //  PLAFEditor

	/** Diable Theme Field          */
	private boolean     m_setting = false;
	/** We did test for true color  */
	private boolean     m_colorTest = false;

	static ResourceBundle   s_res = ResourceBundle.getBundle("org.compiere.plaf.PlafRes");
	static Object[]         s_columns = new Object[] {"-0-", "-1-", "-2-", "-3-", "-O-", "-l-"};
	static Object[][]       s_data = new Object[][] {
		{"-00-", "-01-", "-02-", "-03-", "-0O-", "-0l-"},
		{"-10-", "-11-", "-12-", "-13-", "-1O-", "-1l-"},
		{"-20-", "-21-", "-22-", "-23-", "-2O-", "-2l-"},
		{"-30-", "-31-", "-32-", "-33-", "-3O-", "-3l-"},
		{"-O0-", "-O1-", "-O2-", "-O3-", "-OO-", "-Ol-"},
		{"-l0-", "-l1-", "-l2-", "-l3-", "-lO-", "-ll-"}};
	static Object[]         s_pos = new Object[] {"Top", "Left", "Bottom", "Right"};

	private CPanel mainPanel = new CPanel(new BorderLayout());
	private CPanel northPanel = new CPanel();
	private CPanel southPanel = new CPanel();
	private CButton bOK = CompierePLAF.getOKButton();
	private CButton bCancel = CompierePLAF.getCancelButton();
	private CButton bHelp = new CButton();	/** @todo Help Button */
	private GridBagLayout northLayout = new GridBagLayout();
	private CLabel lfLabel = new CLabel();
	private CComboBox lfField = new CComboBox(CompierePLAF.getPLAFs());
	private CLabel themeLabel = new CLabel();
	private CComboBox themeField = new CComboBox(CompierePLAF.getThemes());
	private CButton cButton = new CButton();
	private FlowLayout southLayout = new FlowLayout();
	private CButton rButton = new CButton();
	private CButton bSetColor = new CButton();
	private CCheckBox cDefault = new CCheckBox();
	private CComboBox blindField = new CComboBox(ColorBlind.COLORBLIND_TYPE);
	private CLabel blindLabel = new CLabel();
	private BorderLayout mainLayout = new BorderLayout();
	//
	private CTabbedPane example = new CTabbedPane();
	private CPanel jPanel1 = new CPanel();
	private TitledBorder exampleBorder;
	private CPanel jPanel2 = new CPanel();
	private JLabel jLabel1 = new JLabel();
	private JTextField jTextField1 = new JTextField();
	private JCheckBox jCheckBox1 = new JCheckBox();
	private JRadioButton jRadioButton1 = new JRadioButton();
	private CButton jButton1 = new CButton();
	private CToggleButton jToggleButton1 = new CToggleButton();
	private CComboBox jComboBox1 = new CComboBox(s_columns);
	private JTextArea jTextArea1 = new JTextArea();
	private JTextPane jTextPane1 = new JTextPane();
	private JEditorPane jEditorPane1 = new JEditorPane();
	private JPasswordField jPasswordField1 = new JPasswordField();
	private JList jList1 = new JList(s_columns);
	private JSplitPane jSplitPane1 = new JSplitPane();
	private BorderLayout borderLayout1 = new BorderLayout();
	private JScrollPane jScrollPane1 = new JScrollPane();
	private JTree jTree1 = new JTree();
	private JScrollPane jScrollPane2 = new JScrollPane();
	private JTable jTable1 = new JTable(s_data, s_columns);
	private GridBagLayout gridBagLayout1 = new GridBagLayout();
	private CPanel jPanelFlat = new CPanel(new CompiereColor(new Color(255,205,255), true));
	private CPanel jPanelGradient = new CPanel(new CompiereColor(new Color(233,210,210), new Color(217,210,233)));
	private CPanel jPanelTexture = new CPanel(new CompiereColor(CompiereColor.class.getResource("vincent.jpg"), Color.lightGray, 0.7f));
	private CPanel jPanelLines = new CPanel(new CompiereColor(new Color(178,181,205), new Color(193,193,205), 1.0f, 5));
	private JButton jButtonFlat = new JButton();
	private CButton jButtonGardient = new CButton();
	private JButton jButtonTexture = new JButton();
	private CButton jButtonLines = new CButton();
	private JComboBox jComboBoxFlat = new JComboBox(s_pos);
	private JTextField jTextFieldFlat = new JTextField();
	private JLabel jLabelFlat = new JLabel();
	private CComboBox jComboBoxGradient = new CComboBox(s_pos);
	private CTextField jTextFieldGradient = new CTextField();
	private CLabel jLabelGradient = new CLabel();
	private JComboBox jComboBoxTexture = new JComboBox(s_pos);
	private JTextField jTextFieldTexture = new JTextField();
	private JLabel jLabelTexture = new JLabel();
	private CComboBox jComboBoxLines = new CComboBox(s_pos);
	private CTextField jTextFieldLines = new CTextField();
	private CLabel jLabelLines = new CLabel();
	private CCheckBox jCheckBoxLines = new CCheckBox();
	private JCheckBox jCheckBoxTexture = new JCheckBox();
	private CCheckBox jCheckBoxGradient = new CCheckBox();
	private JCheckBox jCheckBoxFlat = new JCheckBox();

	/**
	 *  Static Layout
	 *  @throws Exception
	 */
	private void jbInit() throws Exception
	{
		this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		this.setTitle(s_res.getString("LookAndFeelEditor") + " " + CompierePLAF.VERSION);
		mainPanel.setLayout(mainLayout);
		mainLayout.setHgap(5);
		mainLayout.setVgap(5);
		jTextFieldFlat.setColumns(10);
		jTextFieldGradient.setColumns(10);
		jTextFieldTexture.setColumns(10);
		jTextFieldLines.setColumns(10);
		jCheckBoxLines.setText("jCheckBox");
		jCheckBoxTexture.setText("jCheckBox");
		jCheckBoxGradient.setText("jCheckBox");
		jCheckBoxFlat.setText("jCheckBox");
		jPanelGradient.setToolTipText("Indented Level 1");
		jPanelTexture.setToolTipText("Indented Level 2");
		jPanelLines.setToolTipText("Indented Level 1");
		this.getContentPane().add(mainPanel,  BorderLayout.CENTER);
		CompiereColor.setBackground(this);
		//
		lfLabel.setText(s_res.getString("LookAndFeel"));
		lfField.addActionListener(this);
		themeLabel.setText(s_res.getString("Theme"));
		themeField.addActionListener(this);
		cButton.setText(s_res.getString("EditCompiereTheme"));
		cButton.addActionListener(this);
		rButton.setText(s_res.getString("Reset"));
		rButton.addActionListener(this);
		cDefault.setText(s_res.getString("SetDefault"));
		cDefault.addActionListener(this);
		bSetColor.setText(s_res.getString("SetDefaultColor"));
		bSetColor.addActionListener(this);
		blindLabel.setText(s_res.getString("ColorBlind"));
		blindField.addActionListener(this);
		//
		bOK.addActionListener(this);
		bCancel.addActionListener(this);
		bHelp.addActionListener(this);
		//
		northPanel.setLayout(northLayout);
		southPanel.setLayout(southLayout);
		southLayout.setAlignment(FlowLayout.RIGHT);
		//
		exampleBorder = new TitledBorder(s_res.getString("Example"));
		example.setBorder(exampleBorder);

		jLabel1.setText("jLabel");
		jTextField1.setText("jTextField");
		jCheckBox1.setText("jCheckBox");
		jRadioButton1.setText("jRadioButton");
		jButton1.setText("jButton");
		jToggleButton1.setText("jToggleButton");
		jTextArea1.setText("jTextArea");
		jTextPane1.setText("jTextPane");
		jEditorPane1.setText("jEditorPane");
		jPasswordField1.setText("jPasswordField");
		jPanel2.setLayout(borderLayout1);
		jPanel1.setLayout(gridBagLayout1);
		jScrollPane1.setPreferredSize(new Dimension(100, 200));
		jScrollPane2.setPreferredSize(new Dimension(100, 200));
		jButtonFlat.setText("Confirm");
		jButtonGardient.setText("Input");
		jButtonTexture.setText("Message");
		jButtonLines.setText("Error");
		jTextFieldFlat.setText("jTextField");
		jLabelFlat.setText("jLabel");
		jTextFieldGradient.setText("jTextField");
		jLabelGradient.setText("jLabel");
		jTextFieldTexture.setText("jTextField");
		jLabelTexture.setText("jLabel");
		jTextFieldLines.setText("jTextField");
		jLabelLines.setText("jLabel");
		mainPanel.add(northPanel, BorderLayout.NORTH);
		northPanel.add(lfLabel,     new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
			,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0));
		northPanel.add(lfField,     new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
			,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 0, 0));
		northPanel.add(themeLabel,      new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
			,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
		northPanel.add(themeField,       new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
			,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
		northPanel.add(cButton,            new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
			,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
		northPanel.add(rButton,        new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
			,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
		northPanel.add(bSetColor,       new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
			,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
		northPanel.add(cDefault,     new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
			,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
		northPanel.add(blindField,   new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0
			,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 12), 0, 0));
		northPanel.add(blindLabel,   new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0
			,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
		mainPanel.add(southPanel, BorderLayout.SOUTH);
		southPanel.add(bCancel, null);
		southPanel.add(bOK, null);
		mainPanel.add(example, BorderLayout.CENTER);
		example.add(jPanel1,  "JPanel");
		jPanel1.add(jTextPane1,                 new GridBagConstraints(2, 3, 1, 1, 0.0, 0.2
			,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
		jPanel1.add(jEditorPane1,                  new GridBagConstraints(1, 3, 1, 1, 0.0, 0.2
			,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
		jPanel1.add(jList1,                        new GridBagConstraints(1, 2, 1, 1, 0.0, 0.2
			,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
		jPanel1.add(jLabel1,            new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
			,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
		jPanel1.add(jTextField1,             new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
			,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
		jPanel1.add(jCheckBox1,           new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
			,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(1, 1, 1, 1), 0, 0));
		jPanel1.add(jRadioButton1,         new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
			,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
		jPanel1.add(jButton1,         new GridBagConstraints(2, 0, 1, 1, 0.0, 0.1
			,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));

⌨️ 快捷键说明

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