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

📄 delclainfo.java

📁 班级管理系统
💻 JAVA
字号:
package lab.lab;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class DelClaInfo extends ClaInfo {
	String cNum_str = "";

	DelClaInfo() {
		this.setTitle("删除班级信息");
		this.setResizable(false);
		cNum.setEditable(false);
		cNum.setText("请查询班级号");
		cDept.setEditable(false);
		cMteacher.setEditable(false);
		cStunum.setEditable(false);
		cMoney.setEditable(false);
		cAttack.setEditable(false);

		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		this.setLocation((screenSize.width - 400) / 2,
				(screenSize.height - 300) / 2 + 45);
	}

	public void downInit() {
		searchInfo.setText("班级号查询");
		searchInfo.setFont(new Font("Dialog", 0, 12));
		downPanel.add(searchInfo);
		deleteInfo.setText("删除");
		deleteInfo.setFont(new Font("Dialog", 0, 12));
		deleteInfo.setEnabled(false);
		downPanel.add(deleteInfo);
		clearInfo.setText("清空");
		clearInfo.setFont(new Font("Dialog", 0, 12));
		downPanel.add(clearInfo);
		exitInfo.setText("退出");
		exitInfo.setFont(new Font("Dialog", 0, 12));
		downPanel.add(exitInfo);

		searchInfo.addActionListener(this);
		deleteInfo.addActionListener(this);
		clearInfo.addActionListener(this);
		exitInfo.addActionListener(this);

		this.contentPane.add(downPanel, BorderLayout.SOUTH);
	}

	public void actionPerformed(ActionEvent e) {
		Object obj = e.getSource();
		String[] s = new String[6];
		if (obj == exitInfo) {
			this.dispose();
		} else if (obj == deleteInfo) {
			int ifdel = JOptionPane.showConfirmDialog(null, "真的要删除该信息?",
					"提示信息", JOptionPane.YES_NO_OPTION,
					JOptionPane.INFORMATION_MESSAGE);
			if (ifdel == JOptionPane.YES_OPTION) {
				ClaBean deleteCla = new ClaBean();
				deleteCla.claDel(cNum_str);
				this.dispose();
				DelClaInfo dci = new DelClaInfo();
				dci.downInit();
				dci.pack();
				dci.setVisible(true);
			} else {
				return;
			}
		} else if (obj == clearInfo) {
			setNull();
			cNum.setText("请查询班级号");
			deleteInfo.setEnabled(false);
		} else if (obj == searchInfo) {
			ClaInfoSearchCnum cisc = new ClaInfoSearchCnum(this);
			cisc.pack();
			cisc.setVisible(true);
			try {
				cNum_str = cisc.getCnum();
			} catch (Exception e1) {
				JOptionPane.showMessageDialog(null, "没有查找到该班级号!");
			}
			ClaBean searchCla = new ClaBean();
			s = searchCla.claSearch(cNum_str);
			if (s == null) {
				JOptionPane.showMessageDialog(null, "记录不存在!");
				cNum.setText("请查询班级号");
				cDept.setText("");
				cMteacher.setText("");
				cStunum.setText("");
				cMoney.setText("");
				cAttack.setText("");

				cDept.setEditable(false);
				cMteacher.setEditable(false);
				cStunum.setEditable(false);
				cMoney.setEditable(false);
				cAttack.setEditable(false);
				deleteInfo.setEnabled(false);
				return;
			} else {
				cNum.setText(cNum_str);
				cDept.setText(s[0]);
				cMteacher.setText(s[1]);
				cStunum.setText(s[2]);
				cMoney.setText(s[3]);
				cAttack.setText(s[4]);

				cDept.setEditable(false);
				cMteacher.setEditable(false);
				cStunum.setEditable(false);
				cMoney.setEditable(false);
				cAttack.setEditable(false);
				deleteInfo.setEnabled(true);
			}
		}
	}

}

⌨️ 快捷键说明

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