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

📄 aboutdialog.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
字号:
/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

package eti.bi.alphaminer.ui;

import java.awt.AWTEvent;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;

import eti.bi.exception.SysException;
import eti.bi.util.ResourceLoader;
import eti.bi.alphaminer.core.observer.Observer;
import eti.bi.common.ImageLocation;
import eti.bi.common.Locale.Resource;
import eti.bi.common.System.AlphaminerConstants;

/**
 * AboutDialog is a JDialog which shows some brief information of
 * the KBBI-client application.
 */
public class AboutDialog extends JDialog implements Observer,ActionListener {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	JPanel panel1 = new JPanel();
	JPanel panel2 = new JPanel();
	JPanel insetsPanel1 = new JPanel();
	JPanel insetsPanel2 = new JPanel();
	JPanel insetsPanel3 = new JPanel();
	JButton m_ButtonOK = new JButton();
	JLabel imageLabel = new JLabel();
	JLabel label1 = new JLabel();
	JLabel label2 = new JLabel();
	JLabel label3 = new JLabel();
	JLabel label4 = new JLabel();
	JLabel label5 = new JLabel();
	ImageIcon image1 = new ImageIcon();
	BorderLayout borderLayout1 = new BorderLayout();
	BorderLayout borderLayout2 = new BorderLayout();
	FlowLayout flowLayout1 = new FlowLayout();
	GridLayout gridLayout1 = new GridLayout();
	
	private String m_ProductName = "";
	private String m_Version = "";
	private String m_Comments = "";
	private String m_contact;
	private String m_developer;
	
	/**
	 * Constructs an AboutDialog.
	 * @throws SysException
	 */
	public AboutDialog(Frame parent) throws SysException {
		super(parent);
		enableEvents(AWTEvent.WINDOW_EVENT_MASK);
		     
		m_Version = AlphaminerConstants.Version;
		m_ProductName = AlphaminerConstants.Productname;
		m_Comments = AlphaminerConstants.Aboutcomment;
		m_contact = AlphaminerConstants.Contact;
		m_developer = AlphaminerConstants.Developer;
		createAboutDialog();
	}

	/**
	 * @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
	 */
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == m_ButtonOK) {
			cancel();
		}
	}
	
	/**
	 * @see java.awt.Window#processWindowEvent(WindowEvent)
	 */
	protected void processWindowEvent(WindowEvent e) {
		if (e.getID() == WindowEvent.WINDOW_CLOSING) {
			cancel();
		}
		super.processWindowEvent(e);
	}

	/**
	 * Closes the AboutDialog frame by making it invisible.
	 */
	private void cancel() {
		setVisible(false);
	}
	
	/**
	 * Creates a AboutDialog.
	 * @throws SysException
	 */
	private void createAboutDialog() throws SysException {
		image1 = ResourceLoader.getImageIcon(ImageLocation.ABOUT);
		imageLabel.setIcon(image1);
		this.setModal(true);
		this.setTitle(Resource.srcStr("titleabout"));
		panel1.setLayout(borderLayout1);
		panel2.setLayout(borderLayout2);
		insetsPanel1.setLayout(flowLayout1);
		insetsPanel2.setLayout(flowLayout1);
		insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 10));
		insetsPanel2.setMinimumSize(new Dimension(100, 100));
		insetsPanel2.setPreferredSize(new Dimension(100, 100));
		gridLayout1.setRows(9);
		gridLayout1.setColumns(1);
		
		label1.setText(m_ProductName);
		label2.setText(m_Version);
		label3.setText(m_Comments);
		label4.setText(m_contact);
		label5.setText(m_developer);
		insetsPanel3.setLayout(gridLayout1);
		insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		insetsPanel3.setMinimumSize(new Dimension(300, 250));
		m_ButtonOK.setToolTipText("");
		m_ButtonOK.setActionCommand("OK");
		m_ButtonOK.setText(Resource.srcStr("m_ButtonOK"));
		m_ButtonOK.addActionListener(this);
		panel1.setMinimumSize(new Dimension(400, 250));
		panel1.setRequestFocusEnabled(true);
		panel2.setMinimumSize(new Dimension(400, 150));
		insetsPanel1.setMinimumSize(new Dimension(400, 37));
		insetsPanel3.add(label1, null);
		insetsPanel3.add(new JLabel(),null);
		insetsPanel3.add(label2, null);
		insetsPanel3.add(new JLabel(),null);
		insetsPanel3.add(label3, null);
		insetsPanel3.add(new JLabel(),null);
		insetsPanel3.add(label4, null);
		insetsPanel3.add(new JLabel(),null);
		insetsPanel3.add(label5, null);
		
		panel2.add(insetsPanel2, BorderLayout.WEST);
		insetsPanel2.add(imageLabel, null);
		panel2.add(insetsPanel3, BorderLayout.CENTER);
		panel1.add(insetsPanel1, BorderLayout.SOUTH);
		insetsPanel1.add(m_ButtonOK, null);
		panel1.add(panel2, BorderLayout.NORTH);
		setResizable(false);
		this.getContentPane().add(panel1, BorderLayout.CENTER);
	}
	/**
	 * @return Returns the m_ProductName.
	 */
	public String getProductName() {
		return m_ProductName;
	}
	/**
	 * @param productName The m_ProductName to set.
	 */
	public void setProductName(String productName) {
		m_ProductName = productName;
	}
	/**
	 * @return Returns the m_Version.
	 */
	public String getVersion() {
		return m_Version;
	}
	/**
	 * @param version The m_Version to set.
	 */
	public void setVersion(String version) {
		m_Version = version;
	}

	public void sendNotify(String a_Message) {
		if(a_Message.equals(Resource.CHANGE_LOCALE)) {
			this.setTitle(Resource.srcStr("titleabout"));
			
			m_ButtonOK.setText(Resource.srcStr("m_ButtonOK"));
			
			label1.setText(m_ProductName);
			label2.setText(m_Version);
			label3.setText(m_Comments);
			label4.setText(m_contact);
			label5.setText(m_developer);
		}
	}

	public void sendNotify(int a_Message) {
	}

	public void sendNotify(int a_Message, Object a_Object) {
	}
}

⌨️ 快捷键说明

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