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

📄 compierethemeeditor.java

📁 Java写的ERP系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		compiereColorPanel.add(txt_error, null);
		centerPanel.add(fontPanel, BorderLayout.SOUTH);
		fontPanel.add(controlFont, null);
		fontPanel.add(systemFont, null);
		fontPanel.add(menuFont, null);
		fontPanel.add(userFont, null);
		fontPanel.add(windowFont, null);
		fontPanel.add(smallFont, null);
		compiereColorPanel.add(error, null);
		compiereColorPanel.add(inactive, null);
		compiereColorPanel.add(txt_ok, null);
		compiereColorPanel.add(mandatory, null);
		compiereColorPanel.add(info, null);
		bCancel.addActionListener(this);
		bOK.addActionListener(this);
	}   //  jbInit

	/**
	 *  Load Theme from current Setting (if MetalLookAndFeel)
	 */
	private void loadTheme()
	{
		if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel)
		{
			CompiereTheme.setTheme();
		}
		else    //  Not a Metal Theme
		{
			primary1.setEnabled(false);
			primary2.setEnabled(false);
			primary3.setEnabled(false);
			secondary1.setEnabled(false);
			secondary2.setEnabled(false);
			secondary3.setEnabled(false);
		}
	}   //  loadTheme

	/**
	 *  Dynamic Init
	 */
	private void dynInit()
	{
	//	System.out.println("CompiereThemeEditor.dynInit");
		CompiereTheme ct = CompiereLookAndFeel.getCompiereTheme();
		//  Colors
		primary1.setBackground(ct.getPrimary1());
		primary2.setBackground(ct.getPrimary2());
		primary3.setBackground(ct.getPrimary3());
		secondary1.setBackground(ct.getSecondary1());
		secondary2.setBackground(ct.getSecondary2());
		secondary3.setBackground(ct.getSecondary3());
		//
		white.setBackground(ct.getWhite());
		black.setBackground(ct.getSecondary3());
		black.setForeground(ct.getBlack());
		//
		error.setBackground(CompierePLAF.getFieldBackground_Error());
		mandatory.setBackground(CompierePLAF.getFieldBackground_Mandatory());
		inactive.setBackground(CompierePLAF.getFieldBackground_Inactive());
		info.setBackground(CompierePLAF.getInfoBackground());
		//
		txt_ok.setBackground(CompierePLAF.getFieldBackground_Normal());
		txt_ok.setForeground(CompierePLAF.getTextColor_OK());
		txt_error.setBackground(CompierePLAF.getFieldBackground_Normal());
		txt_error.setForeground(CompierePLAF.getTextColor_Issue());

		//  Fonts
		controlFont.setFont(ct.getControlTextFont());
		systemFont.setFont(ct.getSystemTextFont());
		userFont.setFont(ct.getUserTextFont());
		smallFont.setFont(ct.getSubTextFont());
		menuFont.setFont(ct.getMenuTextFont());
		windowFont.setFont(ct.getWindowTitleFont());
	}   //  dynInit

	/**
	 *  Action Listener
	 *  @param e
	 */
	public void actionPerformed(ActionEvent e)
	{
	//	System.out.println("CompiereThemeEditor.actionPerformed " + e);
		//  Confirm
		if (e.getSource() == bOK)
		{
			CompiereTheme.save(Ini.getProperties());
			dispose();
			return;
		}
		//  Cancel
		else if (e.getSource() == bCancel)
		{
			dispose();
			return;
		}
		CompiereTheme vt = new CompiereTheme();

		try {                   //  to capture errors when Cancel in JColorChooser

		if (e.getSource() == primary1)
		{
			CompiereTheme.primary1 = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("Primary1"), CompiereTheme.primary1));
		}
		else if (e.getSource() == primary2)
		{
			CompiereTheme.primary2 = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("Primary2"), CompiereTheme.primary2));
		}
		else if (e.getSource() == primary3)
		{
			CompiereTheme.primary3 = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("Primary3"), CompiereTheme.primary3));
		}
		else if (e.getSource() == secondary1)
		{
			CompiereTheme.secondary1 = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("Secondary1"), CompiereTheme.secondary1));
		}
		else if (e.getSource() == secondary2)
		{
			CompiereTheme.secondary2 = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("Secondary2"), CompiereTheme.secondary2));
		}
		else if (e.getSource() == secondary3)
		{
			CompiereTheme.secondary3 = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("Secondary3"), CompiereTheme.secondary3));
		}

		else if (e.getSource() == error)
		{
			CompiereTheme.error = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("Error"), CompiereTheme.error));
		}
		else if (e.getSource() == mandatory)
		{
			CompiereTheme.mandatory = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("Mandatory"), CompiereTheme.mandatory));
		}
		else if (e.getSource() == inactive)
		{
			CompiereTheme.inactive = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("Inactive"), CompiereTheme.inactive));
		}
		else if (e.getSource() == info)
		{
			CompiereTheme.info = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("Info"), CompiereTheme.info));
		}

		else if (e.getSource() == black)
		{
			CompiereTheme.black = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("Black"), CompiereTheme.black));
		}
		else if (e.getSource() == white)
		{
			CompiereTheme.white = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("White"), CompiereTheme.white));
		}
		else if (e.getSource() == txt_ok)
		{
			CompiereTheme.txt_ok = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("TextOK"), CompiereTheme.txt_ok));
		}
		else if (e.getSource() == txt_error)
		{
			CompiereTheme.txt_error = new ColorUIResource(JColorChooser.showDialog
				(this, s_res.getString("TextIssue"), CompiereTheme.txt_error));
		}

		else if (e.getSource() == controlFont)
		{
			CompiereTheme.controlFont = new FontUIResource(FontChooser.showDialog
				(this, s_res.getString("ControlFont"), vt.getControlTextFont()));
		}
		else if (e.getSource() == systemFont)
		{
			CompiereTheme.systemFont = new FontUIResource(FontChooser.showDialog
				(this, s_res.getString("SystemFont"), vt.getSystemTextFont()));
		}
		else if (e.getSource() == userFont)
		{
			CompiereTheme.userFont = new FontUIResource(FontChooser.showDialog
				(this, s_res.getString("UserFont"), vt.getUserTextFont()));
		}
		else if (e.getSource() == smallFont)
		{
			CompiereTheme.smallFont = new FontUIResource(FontChooser.showDialog
				(this, s_res.getString("SmallFont"), vt.getSubTextFont()));
		}
		else if (e.getSource() == menuFont)
		{
			CompiereTheme.menuFont = new FontUIResource(FontChooser.showDialog
				(this, s_res.getString("MenuFont"), vt.getMenuTextFont()));
		}
		else if (e.getSource() == windowFont)
		{
			CompiereTheme.windowFont = new FontUIResource(FontChooser.showDialog
				(this, s_res.getString("WindowTiteFont"), vt.getWindowTitleFont()));
		}

		} catch (Exception ee) {}   //  to capture errors when Cancel in JColorChooser

		dynInit();
	}   //  actionPerformed

}   //  CompiereThemeEditor

⌨️ 快捷键说明

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