📄 delstuinformation.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package stuMS;import java.awt.*;import java.sql.*;import java.awt.event.*;import javax.swing.*;/** * 学生信息管理模块 * 删除学生信息的类 * @author Administrator */public class DelStuInformation extends stuInformationJFrame implements ActionListener { String SnoStr = null; int intX = 110,intY = 4; public DelStuInformation(){ this.setTitle("删除学生信息"); this.setResizable(false); Sno.setEditable(false); Sno.setText("请查询学号"); Sname.setEditable(false); Ssex.setEditable(false); Sethnic.setEditable(false); Sbirth.setEditable(false); Sdate.setEditable(false); Smajor.setEditable(false); Scollege.setEditable(false); Shometown.setEditable(false); this.setLocationRelativeTo(rootPane); } public void downInit(){ searchStuInformationButton.setText("查询"); searchStuInformationButton.setFont(new Font("Dialog",0,12)); controlPanel.add(searchStuInformationButton); searchStuInformationButton.setBounds(intX, intY, 62, 30); intX += 62; deleteStuInformationButton.setText("删除"); deleteStuInformationButton.setFont(new Font("Dialog",0,12)); controlPanel.add(deleteStuInformationButton); deleteStuInformationButton.setBounds(intX, intY, 62, 30); intX += 62; exitButton.setText("退 出"); exitButton.setFont(new Font("Dialog",0,12)); controlPanel.add(exitButton); exitButton.setBounds(intX, intY, 62, 30); searchStuInformationButton.setEnabled(true); deleteStuInformationButton.setEnabled(false); exitButton.setEnabled(true); /** * 移除先前的监听事件 */ searchStuInformationButton.removeActionListener(this); deleteStuInformationButton.removeActionListener(this); exitButton.removeActionListener(this); /** * 添加新的监听事件 */ searchStuInformationButton.addActionListener(this); deleteStuInformationButton.addActionListener(this); exitButton.addActionListener(this); } /** * 事件处理 */ public void actionPerformed(ActionEvent e) { Object obj = e.getSource(); String[] s = new String[9]; if (obj == exitButton) { //退出 this.dispose(); } else if (obj == deleteStuInformationButton) { //删除 int ifdel = JOptionPane.showConfirmDialog(null,"真的要删除该信息?","提示信息",JOptionPane.YES_NO_OPTION,JOptionPane.INFORMATION_MESSAGE ); if(ifdel == JOptionPane.YES_OPTION){ StuBean delStu = new StuBean(); delStu.stuDel(Sno.getText()); this.setNull(); //this.dispose(); } else{ return; } } else if (obj == searchStuInformationButton) { //学号查询 StuInfoSearchSnum searchSno = new StuInfoSearchSnum(this,true); //siss.pack(); searchSno.setVisible(true); SnoStr = searchSno.getSnum(); StuBean searchStu = new StuBean(); s = searchStu.stuSearch(SnoStr); if(s == null){ JOptionPane.showMessageDialog(null, "记录不存在!"); Sno.setText("请查询学号"); Sname.setEditable(false); Ssex.setEditable(false); Sethnic.setEditable(false); Sbirth.setEditable(false); Sdate.setEditable(false); Smajor.setEditable(false); Scollege.setEditable(false); Shometown.setEditable(false); return; } else{ Sno.setText(s[0]); Sname.setText(s[1]); Ssex.setText(s[2]); Sbirth.setText(s[3]); Sethnic.setText(s[4]); Shometown.setText(s[5]); Sdate.setText(s[6]); Smajor.setText(s[7]); Scollege.setText(s[8]); deleteStuInformationButton.setEnabled(true); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -