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

📄 empinfoinputeeid.java

📁 完整的JAVA工程
💻 JAVA
字号:
package employee;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/**
 * 人事信息管理模块
 * 根据职工编号查询职工的信息,以供调用者修改或删除
 */
public class EmpInfoInputEeid extends JDialog implements ActionListener{
	Container contentPane;
	String[] s;
	//框架的大小
	Dimension faceSize = new Dimension(300, 100);
	JLabel jLabel1 = new JLabel();
	JTextField inputEeid = new JTextField(10);
	JButton searchInfo = new JButton();

	
	public EmpInfoInputEeid(JFrame frame) {
		super(frame, true);
		this.setTitle("职工编号查询");
		this.setResizable(false);
		try {
			Init();
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		//设置运行位置,使对话框居中
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		this.setLocation( (int) (screenSize.width - 400) / 2 ,
						(int) (screenSize.height - 300) / 2 +45);

	}
	
	private void Init() throws Exception {
		this.setSize(faceSize);
		contentPane = this.getContentPane();
		contentPane.setLayout(new FlowLayout());

		jLabel1.setText("请输入职工编号:");
		jLabel1.setFont(new Font("Dialog",0,12));
		contentPane.add(jLabel1);
		inputEeid.setEditable(true);
		inputEeid.setFont(new Font("Dialog",0,12));
		contentPane.add(inputEeid);

		searchInfo.setText("查询");
		searchInfo.setFont(new Font("Dialog",0,12));
		contentPane.add(searchInfo);

		searchInfo.addActionListener(this);

	}

	/**
	 * 事件处理
	 */
	public void actionPerformed(ActionEvent e) {
		Object obj = e.getSource();
		if (obj == inputEeid) { //退出
			this.dispose();
		}
		else if (obj == searchInfo) { //修改
			if((inputEeid.getText()).equals(null)||(inputEeid.getText()).equals("")){
				JOptionPane.showMessageDialog(null, "您输入的职工编号不能为空!", "错误", JOptionPane.ERROR_MESSAGE);
				inputEeid.requestFocus();
				return;
			}
			this.dispose();
		}
	}

	/**
	 * 返回选择的职工编号
	 */
	public String getEeid(){
		return (String)this.inputEeid.getText();
	}
}

⌨️ 快捷键说明

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