有代码的
功能级用例描述——修改学生信息
有代码的
功能级用例描述——删除学生信息
2、程序主要代码的实现
有代码的
inst.setLocationRelativeTo(null); inst.setVisible(tru
e); } }); } public StudentJFrame() { super("学生选修课管理系统"); initGUI(); } private void initGUI() { try { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setForeground(new java.awt.Color(0,0,255)); { //标题 Panel titlePanel = new JPanel(); getContentPane().add(titlePanel, BorderLayout.NORTH); titlePanel.setPreferredSize(new java.awt.Dimension(384, 91)); { titleLabel = new JLabel(); titlePanel.add(titleLabel); titleLabel.setText("\u6b22\u8fce\u8fdb\u5165\u5b66\u751f\u9009\u4fee\u8bfe\u7ba1\u7406\u7cfb\u7edf"); titleLabel.setPreferredSize(new java.awt.Dimension(279, 68)); titleLabel.setFont(new java.awt.Font("微软雅黑",1,18)); titleLabel.setForeground(new java.awt.Color(0,0,255)); } } { //选择 Panel mainPanel = new JPanel(); getContentPane().add(mainPanel, BorderLayout.CENTER); mainPanel.setPreferredSize(new java.awt.Dimension(384, 173)); { //“添加”按钮 jButton1 = new JButton(); mainPanel.add(jButton1); jButton1.setText("\u6dfb\u52a0"); jButton1.setPreferredSize(new java.awt.Dimension(83, 36)); jButton1.setFont(new java.awt.Font("微软雅黑",1,14)); jButton1.setForeground(new java.awt.Color(0,255,0)); jButton1.setBackground(new java.awt.Color(0,128,128)); //注册“添加”按钮的监听器,进行两个界面间的转换 jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) {
有代码的
System.out.println("jButton1.actionPerformed, event="+evt); //TODO add your code for jButton1.actionPerformed AddJFrame add=new AddJFrame(); StudentJFrame.this.setVisible(false); } }); } { //“查找”按钮 jButton2 = new JButton(); mainPanel.add(jButton2); jButton2.setText("\u67e5\u627e"); jButton2.setBackground(new java.awt.Color(0,128,128)); jButton2.setFont(new java.awt.Font("微软雅黑",1,14)); jButton2.setForeground(new java.awt.Color(0,255,0)); jButton2.setPreferredSize(new java.awt.Dimension(83, 37)); //注册“查询”按钮的监听器 jButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("jButton2.actionPerformed, event="+evt); //TODO add your code for jButton2.actionPerformed QueryJFrame query=new QueryJFrame(); StudentJFrame.this.setVisible(false); } }); } { //“修改”按钮 jButton3 = new JButton(); mainPanel.add(jButton3); jButton3.setText("\u4fee\u6539"); jButton3.setBackground(new java.awt.Color(0,128,128)); jButton3.setFont(new java.awt.Font("微软雅黑",1,14)); jButton3.setForeground(new java.awt.Color(255,255,0)); jButton3.setPreferredSize(new java.awt.Dimension(83, 36)); jButton3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("jButton2.actionPerformed, event="+evt); //TODO add your code for jButton2.actionPerformed ModifyJFrame mj=new ModifyJFrame(); mj.setVisible(true); StudentJFrame.this.setVisible(false); } });
有代码的
} { //“删除”按钮 jButton4 = new JButton(); mainPanel.add(jButton4);
jButton4.setText("\u5220\u9664"); jButton4.setBackground(new java.awt.Color(0,128,128)); jButton4.setFont(new java.awt.Font("微软雅黑",1,14)); jButton4.setForeground(new java.awt.Color(255,255,0)); jButton4.setPreferredSize(new java.awt.Dimension(83, 37)); jButton4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("jButton4.actionPerformed, event="+evt); //TODO add your code for jButton4.actionPerformed CancelJFrame cjf=new CancelJFrame(); StudentJFrame.this.setVisible(false); cjf.setVisible(true); } }); } } pack(); setSize(400, 300); } catch (Exception e) { e.printStackTrace(); } } }
2.2 AddJFrame 类用于添加学生package jframe; import java.awt.*; import java.awt.event.*; import javax.swing.*; import dao.DaoFactory; import domain.Student; public class AddJFrame extends javax.swing.JFrame implements ItemListener { private JPanel titlePanel1; private JLabel jLabel2; private JButton fqButton1; private JButton tjButton1; private JLabel titleLabel1; private JTextField jTextField1;
有代码的
private JLabel sexLabel1; private JLabel noLabel1; private JTextField noTextField1; private JTextField nameTextField1; private JLabel nameLabel1; private JPanel southPanel1; private JPanel mainPanel1; private JPanel eastPanel1; private JPanel westPanel1; private JRadioButton manRadioButton1; private JRadioButton womenRadioButton1; private JLabel kongLabel3; private String sex; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { AddJFrame inst = new AddJFrame(); inst.setLocationRelativeTo(null); inst.setVisible(true); } }); } public AddJFrame() { super("添加学生信息"); initGUI(); this.setVisible(true); } private void initGUI() { try { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { titlePanel1 = new JPanel(); getContentPane().add(titlePanel1, BorderLayout.NORTH); titlePanel1.setPreferredSize(new java.awt.Dimension(384, 65)); { titleLabel1 = new JLabel(); titlePanel1.add(titleLabel1); titleLabel1.setText("\u8bf7\u8f93\u5165\u5b66\u751f\u4fe1\u606f"); titleLabel1.setPreferredSize(new java.awt.Dimension(124, 34)); titleLabel1.setFont(new java.awt.Font("微软雅黑",0,16)); } } { //东,西两块空 panel,美观作用
有代码的
westPanel1 = new JPanel(); getContentPane().add(westPanel1, BorderLayout.WEST); westPanel1.setPreferredSize(new java.awt.Dimension(72, 211)); } { eastPanel1 = new JPanel(); getContentPane().add(eastPanel1, BorderLayout.EAST); eastPanel1.setPreferredSize(new java.awt.Dimension(89, 169)); } { southPanel1 = new JPanel(); getContentPane().add(southPanel1, BorderLayout.SOUTH); southPanel1.setPreferredSize(new java.awt.Dimension(384, 70)); { //提交按钮 tjButton1 = new JButton(); southPanel1.add(tjButton1); tjButton1.setText("\u63d0\u4ea4"); tjButton1.setPreferredSize(new java.awt.Dimension(76, 27)); tjButton1.setFont(new java.awt.Font("微软雅黑",1,14)); //注册“提交”按钮监听器 tjButton1.addActionListener(n
ew ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("tjButton1.actionPerformed, event="+evt); //TODO add your code for tjButton1.actionPerformed //把添加的信息传给 DaoFactory 中 getStudentDao 里的 addStudent 方法中的相应参数 Student student = new Student(); student.setStudentName(nameTextField1.getText()); student.setStudentNo(Integer.parseInt(noTextField1.getText())); student.setStudentSex(sex); student.setStudentAge(Integer.parseInt(jTextField1.getText())); System.out.println("*********"+nameTextField1.getText()); //起测试作用 try { DaoFactory.getInstance().getStudentDao().addStudent(stu dent); } catch (Exception e) { e.printStackTrace(); } //成功添加提示 JOptionPane.showMessageDialog(null, "成功添加","", RMATION_MESSAGE);
有代码的
} }); } { //空 label 用来调提交和放弃按钮的距离,美观作用 kongLabel3 = new JLabel(); southPanel1.add(kongLabel3); kongLabel3.setPreferredSize(new java.awt.Dimension(22, 9)); } { //放弃按钮 fqButton1 = new JButton(); southPanel1.add(fqButton1); fqButton1.setText("\u653e\u5f03"); fqButton1.setFont(new java.awt.Font("微软雅黑",1,14)); fqButton1.setPreferredSize(new java.awt.Dimension(75, 27)); //注册“放弃”按钮的监听器,重回主界面 fqButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("fqButton1.actionPerformed, event="+evt); //TODO add your code for fqButton1.actionPerformed StudentJFrame sjf=new StudentJFrame(); sjf.setVisible(true); AddJFrame.this.setVisible(false); } }); } } { mainPanel1 = new JPanel(); getContentPane().add(mainPanel1, BorderLayout.CENTER); ButtonGroup bgp=new ButtonGroup(); mainPanel1.setPreferredSize(new java.awt.Dimension(235, 170)); { //姓名标签和文本框 nameLabel1 = new JLabel(); mainPanel1.add(nameLabel1); nameLabel1.setText("\u59d3\u540d"); nameLabel1.setPreferredSize(new java.awt.Dimension(46, 38)); nameLabel1.setFont(new java.awt.Font("微软雅黑",0,14)); } { nameTextField1 = new JTextField(); mainPanel1.add(nameTextField1);
有代码的
nameTextField1.setPreferredSize(new java.awt.Dimension(132, 34)); } { //学号标签和文本框 noLabel1 = new JLabel(); mainPanel1.add(noLabel1); noLabel1.setText("\u5b66\u53f7"); noLabel1.setFont(new java.awt.Font("微软雅黑",0,14)); noLabel1.setPreferredSize(new java.awt.Dimension(46, 19)); } { noTextField1 = new JTextField(); mainPanel1.add(noTextField1); noTextField1.setPreferredSize(new java.awt.Dimension(132, 31)); } { // 性别标签 sexLabel1 = new JLabel(); mainPanel1.add(sexLabel1); sexLabel1.setText("\u6027\u522b"); sexLabel1.setFont(new java.awt.Font("微软雅黑",0,14)); sexLabel1.setPreferredSize(new java.awt.Dimension(50, 22)); } { //”男“,”女“单选框的设置 manRadioButton1 = new JRadioButton(); mainPanel1.add(manRadioButton1); bgp.add(manRadioButton1); //把单选框加到 ButtonGroup 中 manRadioButton1.setText("\u7537"); manRadioButton1.se
tPreferredSize(new java.awt.Dimension(57, 23)); manRadioButton1.addItemListener(this); } { womenRadioButton1 = new JRadioButton(); mainPanel1.add(womenRadioButton1); bgp.add(womenRadioButton1); //把单选框加到 ButtonGroup 中 womenRadioButton1.setText("\u5973"); womenRadioButton1.setPreferredSize(new java.awt.Dimension(68, 22)); womenRadioButton1.addItemListener(this); } { //年龄标签和文本框 jLabel2 = new JLabel(); mainPanel1.add(jLabel2);
有代码的
jLabel2.setText("\u5e74\u9f84"); jLabel2.setFont(new java.awt.Font("微软雅黑",0,14)); jLabel2.setPreferredSize(new java.awt.Dimension(46, 22)); } { jTextField1 = new JTextField(); mainPanel1.add(jTextField1); jTextField1.setPreferredSize(new java.awt.Dimension(132, 31)); } } pack(); pack(); } catch (Exception e) { e.printStackTrace(); } } //设置单选框所选内容以备“性别”的监听器把内容返回给数据库 public void itemStateChanged(ItemEvent e) { // TODO Auto-generated method stub if(manRadioButton1.isSelected()){ sex="男"; } if(womenRadioButton1.isSelected()){ sex="女"; } } }
2.3 QureyJFrame 类用于查询学生package jframe; import java.awt.BorderLayout; import java.awt.event.*; import javax.swing.*; import dao.DaoFactory; import domain.Student; public class QueryJFrame extends javax.swing.JFrame { private JPanel titlePanel2; private JButton qdButton2; private JTextField noTextField2; private JLabel ageLabel2; private JTextField ageTextField2; private JTextField sexTextField2; private JButton bacdButton2;
有代码的
private JPanel backPanel2; private JLabel sexLabel2; private JTextField nameTextField2; private JLabel nameLabel2; private JLabel queryLabel2; private JPanel mainPanel2; private JLabel queryLabel; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { QueryJFrame inst = new QueryJFrame(); inst.setLocationRelativeTo(null); inst.setVisible(true); } }); } public QueryJFrame() { super("查找"); initGUI(); this.setVisible(true); } private void initGUI() { try { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { //标题块,提示 titlePanel2 = new JPanel(); getContentPane().add(titlePanel2, BorderLayout.NORTH); titlePanel2.setPreferredSize(new java.awt.Dimension(384, 58)); { queryLabel = new JLabel(); titlePanel2.add(queryLabel); queryLabel.setText("\u8bf7\u8f93\u5165\u8981\u67e5\u627e\u7684\u5b66\u751f\u5b66\u53f7"); queryLabel.setPreferredSize(new java.awt.Dimension(166, 70)); queryLabel.setFont(new java.awt.Font("微软雅黑",0,14)); } { //输入要查找的学生学号 noTextField2 = new JTextField(); titlePanel2.add(noTextField2); noTextField2.setPreferredSize(new java.awt.Dimension(116, 33)); } { //查询
有代码的
qdButton2 = new JButton(); titlePanel2.add(qdButton2); qdButton2.setText("\u786e\u5b9a"); qdButton2.setPreferredSize(new java.awt.Dimension(73, 35)); qdButton2.setFont(new java.awt.Font("微软雅黑",1,14)); //查询监听器 qdButton2.addActionListener(new ActionListener() { public void acti
onPerformed(ActionEvent evt) { System.out.println("qdButton2.actionPerformed, event="+evt); //TODO add your code for qdButton2.actionPerformed int studentNo=Integer.parseInt(noTextField2.getText());//转化类型 Student student=new Student(); try { //从 Factory 中调用 StudentDao 中的通过学号查找方法查询 学生 student=DaoFactory.getInstance().getStudentDao().selectByStudentNo(studentNo); //把从数据库中返回的内容传给文本框 nameTextField2.setText(student.getStudentName()); sexTextField2.setText(student.getStudentSex()); ageTextField2.setText(""+student.getStudentAge()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } } { //查询结果界面 mainPanel2 = new JPanel(); getContentPane().add(mainPanel2, BorderLayout.CENTER); mainPanel2.setPreferredSize(new java.awt.Dimension(384, 160)); { queryLabel2 = new JLabel(); mainPanel2.add(queryLabel2); queryLabel2.setText("\u60a8\u6240\u67e5\u627e\u7684\u5b66\u751f\u4fe1\u606f"); queryLabel2.setPreferredSize(new java.awt.Dimension(318, 37)); queryLabel2.setFont(new java.awt.Font("微软雅黑",0,14)); queryLabel2.setForeground(new java.awt.Color(0,0,255)); } {
有代码的
nameLabel2 = new JLabel(); mainPanel2.add(nameLabel2); nameLabel2.setText("\u59d3\u540d"); nameLabel2.setPreferredSize(new java.awt.Dimension(121, 17)); nameLabel2.setFont(new java.awt.Font("微软雅黑",0,14)); } { nameTextField2 = new JTextField(); mainPanel2.add(nameTextField2); nameTextField2.setPreferredSize(new java.awt.Dimension(185, 32)); } { sexLabel2 = new JLabel(); mainPanel2.add(sexLabel2); sexLabel2.setText("\u6027\u522b"); sexLabel2.setFont(new java.awt.Font("微软雅黑",0,14)); sexLabel2.setPreferredSize(new java.awt.Dimension(121, 17)); } { sexTextField2 = new JTextField(); mainPanel2.add(sexTextField2); sexTextField2.setPreferredSize(new java.awt.Dimension(185,32)); } { ageLabel2 = new JLabel(); mainPanel2.add(ageLabel2); ageLabel2.setText("\u5e74\u9f84"); ageLabel2.setFont(new java.awt.Font("微软雅黑",0,14)); ageLabel2.setPreferredSize(new java.awt.Dimension(121, 17)); } { ageTextField2 = new JTextField(); mainPanel2.add(ageTextField2); ageTextField2.setPreferredSize(new java.awt.Dimension(185, 32)); } } { //返回界面 backPanel2 = new JPanel(); getContentPane().add(backPanel2, BorderLayout.SOUTH); backPanel2.setPreferredSize(new java.awt.Dimension(384, 38)); { bacdButton2 = new JButton(); backPanel2.add(bacdButton2);
有代码的
bacdButton2.setText("\u8fd4\u56de"); bacdButton2.setPreferredSize(new java.awt.Dimension(95, 28)); bacdButton2.setFont(new java.awt.Font("微软雅黑",1,14)); bacdButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("bacdButton2.actionPerformed,event="+evt); //TODO add your code for bacdButton2.actionPerformed StudentJFrame sjf=new StudentJFrame(); sjf.setVisible(true); QueryJFrame.this.setVisible(false); } }); } } pack(); setSize(400, 300); } catch (Exception e) { e.printS
tackTrace(); } } }
2.4 CancelJFrame 类用于删除学生信息package jframe; import java.awt.BorderLayout; import java.awt.event.*; import javax.swing.*; import dao.DaoFactory; public class CancelJFrame extends javax.swing.JFrame { private JPanel titlePanel3; private JTextField noTextField3; private JPanel mainPanel3; private JLabel jLabel1; private JButton backButton3; private JButton qdButton3; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { CancelJFrame inst = new CancelJFrame(); inst.setLocationRelativeTo(null); inst.setVisible(true); } }); }
有代码的
public CancelJFrame() { super("删除学生信息 "); initGUI(); } private void initGUI() { try { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { //提示输入要删除的学生学号界面 titlePanel3 = new JPanel(); getContentPane().add(titlePanel3, BorderLayout.NORTH); titlePanel3.setPreferredSize(new java.awt.Dimension(392, 118)); { jLabel1 = new JLabel(); titlePanel3.add(jLabel1); jLabel1.setText("\u8bf7\u8f93\u5165\u8981\u5220\u9664\u5b66\u751f\u7684\u5b66\u53f7"); jLabel1.setPreferredSize(new java.awt.Dimension(191, 21)); jLabel1.setFont(new java.awt.Font("SimSun",0,16)); } { } { noTextField3 = new JTextField(); titlePanel3.add(noTextField3); noTextField3.setPreferredSize(new java.awt.Dimension(204, 33)); } } { //确定删除按钮和返回按钮 mainPanel3 = new JPanel(); getContentPane().add(mainPanel3, BorderLayout.CENTER); mainPanel3.setPreferredSize(new java.awt.Dimension(264,204)); { qdButton3 = new JButton(); mainPanel3.add(qdButton3); qdButton3.setText("\u5220\u9664"); qdButton3.setFont(new java.awt.Font("微软雅黑",1,14)); qdButton3.setPreferredSize(new java.awt.Dimension(73,35)); //设置删除按钮的监听器 qdButton3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("qdButton3.actionPerformed, event="+evt); //TODO add your code for qdButton3.actionPerformed int studentNo=Integer.parseInt(noTextField3.getText());
有代码的
try { DaoFactory.getInstance().getStudentDao().deleteStudent(studentNo); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } //提示删除成功 JOptionPane.showMessageDialog(null, "删除成功!"); } }); } { backButton3 = new JButton(); mainPanel3.add(backButton3); backButton3.setText("\u8fd4\u56de"); backButton3.setFont(new java.awt.Font("微软雅黑",1,14)); backButton3.setPreferredSize(new java.awt.Dimension(77, 35)); backButton3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("backButton3.actionPerformed,event="+evt); //TODO add your code for backButton3.actionPerformed StudentJFrame sjf=new StudentJFrame(); sjf.setVisible(true); CancelJFrame.this.setVisible(false); } }); } } pack(); } catch (Exception e) { e.printStackTrace(); } } }
2.5 ModifyJFrame 类用于修改学生package jframe; import java.awt.BorderLayout; import java.awt.eve
nt.*; import javax.swing.*; import domain.Student; import dao.DaoFactory; public class ModifyJFrame extends javax.swing.JFrame { private JPanel titlePanel3;
有代码的
private JLabel jLabel5; private JTextField jTextField4; private JLabel jLabel4; private JButton jButton4; private JPanel Panel4; private JButton jButton1; private JLabel jLabel3; private JTextField jTextField3; private JLabel jLabel2; private JTextField jTextField2; private JLabel jLabel1; private JTextField jTextField1; private JPanel Panel3; private JTextField noTextField3; private JLabel jLabel9; private JButton jButton3; private JButton jButton2; private JLabel jLabel8; private JLabel jLabel7; private JTextField jTextField6; private JLabel jLabel6; private JTextField jTextField5; private JPanel mainPanel3; private JTextField sexTextField3; private JLabel queryLabel4; private JLabel nameLabel3; private JTextField nameTextField3; private JLabel sexLabel3; private JTextField ageTextField3; private JButton bacdButton3; private JLabel ageLabel3; private JLabel modifyLabel3; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { ModifyJFrame inst = new ModifyJFrame(); inst.setLocationRelativeTo(null); inst.setVisible(true); } }); } public ModifyJFrame() { super("修改"); initGUI();
有代码的
} private void initGUI() { try { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); //{ //提示输入修改学生学号界面 titlePanel3 = new JPanel(); getContentPane().add(titlePanel3, BorderLayout.NORTH); titlePanel3.setPreferredSize(new java.awt.Dimension(384, 60)); //{ modifyLabel3 = new JLabel(); titlePanel3.add(modifyLabel3); modifyLabel3.setText("\u8bf7\u8f93\u5165\u8981\u4fee\u6539\u5b66\u751f \u7684\u5b66\u53f7"); modifyLabel3.setPreferredSize(new java.awt.Dimension(170, 54)); modifyLabel3.setFont(new java.awt.Font("微软雅黑",0,14)); //} //{ noTextField3 = new JTextField(); titlePanel3.add(noTextField3); noTextField3.setPreferredSize(new java.awt.Dimension(124, 33)); //} //} //{ //输入修改了的学生信息 界面 mainPanel3 = new JPanel(); getContentPane().add(mainPanel3, BorderLayout.CENTER); mainPanel3.setPreferredSize(new java.awt.Dimension(264, 204)); //{ modifyLabel3 = new JLabel(); mainPanel3.add(modifyLabel3); modifyLabel3.setText("\u60a8\u6240\u9700\u4fee\u6539\u7684\u5b66\u751f\u4fe1\u606f"); modifyLabel3.setFont(new java.awt.Font("微软雅黑",0,14)); modifyLabel3.setForeground(new java.awt.Color(0,0,255)); modifyLabel3.setPreferredSize(new java.awt.Dimension(318, 37)); //} //{ nameLabel3 = new JLabel(); mainPanel3.add(nameLabel3); nameLabel3.setText("\u59d3\u540d"); nameLabel3.setFont(new java.awt.Font("微软雅黑",0,14)); nameLabel3.setPreferredSize(new java.awt.Dimension(121,17));
有代码的
//} //{ nameTextField3 = new JTextField(); mainPanel3.add(nameTextField3); nameTextField3.setPreferredSize(new java.awt.Dimension(185,32)); //} //{ sexLabel3 = new JLabel(); mainPanel3.add(sexLabel3); sexLabel3.setText("\u6027\u522b");
sexLabel3.setFont(new java.awt.Font("微软雅黑",0,14)); sexLabel3.setPreferredSize(new java.awt.Dimension(121,17)); //} //{ sexTextField3 = new JTextField(); mainPanel3.add(sexTextField3); sexTextField3.setPreferredSize(new java.awt.Dimension(185,32)); //} //{ ageLabel3 = new JLabel(); mainPanel3.add(ageLabel3); ageLabel3.setText("\u5e74\u9f84"); ageLabel3.setFont(new java.awt.Font("微软雅黑",0,14)); ageLabel3.setPreferredSize(new java.awt.Dimension(121,17)); //} //{ ageTextField3 = new JTextField(); mainPanel3.add(ageTextField3); ageTextField3.setPreferredSize(new java.awt.Dimension(185,32)); //} //{ //确定修改按钮 bacdButton3 = new JButton(); mainPanel3.add(bacdButton3); bacdButton3.setText("\u4fee\u6539"); bacdButton3.setFont(new java.awt.Font("微软雅黑",1,14)); bacdButton3.setPreferredSize(new java.awt.Dimension(95, 28)); bacdButton3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.out.println("bacdButton3.actionPerformed,event="+evt); //TODO add your code for bacdButton3.actionPerformed //把修改后的信息传给数据库 Student student=new Student(); student.setStudentName(nameTextField3.getText());