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

📄 addstuinformation.java

📁 java编写的与SQL数据连接的好例子~~功能很完善,可以做实训直接交
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package stuMS;import java.awt.event.*;import java.awt.*;import javax.swing.*;/** * * @author Administrator */public class AddStuInformation extends stuInformationJFrame implements ActionListener{    StuBean getSno = new StuBean();    int intX = 110,intY = 4;    public AddStuInformation() {        this.setTitle("添加学生信息");        this.setResizable(false);        Sno.setEditable(false);        Sno.setText(getSno.getNewStuId());        Sname.setEditable(true);        Ssex.setEditable(true);        Sethnic.setEditable(true);        Sbirth.setEditable(true);        Sdate.setEditable(true);        Smajor.setEditable(true);        Scollege.setEditable(true);        Shometown.setEditable(true);        this.setLocationRelativeTo(rootPane);    }    public void downInit(){        addStuInformationButton.setText("添 加");        addStuInformationButton.setFont(new Font("Dialog",0,12));        controlPanel.add(addStuInformationButton);        addStuInformationButton.setBounds(intX, intY, 62, 30);                intX += 62;        clearStuInformationButton.setText("清 空");        clearStuInformationButton.setFont(new Font("Dialog",0,12));        controlPanel.add(clearStuInformationButton);        clearStuInformationButton.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);        //添加监听事件        addStuInformationButton.removeActionListener( this);        clearStuInformationButton.removeActionListener( this);        exitButton.removeActionListener( this);                addStuInformationButton.addActionListener(this);        clearStuInformationButton.addActionListener(this);        exitButton.addActionListener(this);            }     public void actionPerformed(ActionEvent e) {        Object obj = e.getSource();        if (obj == exitButton) { //            this.dispose();        } else if (obj == addStuInformationButton) { //            StuBean addStu = new StuBean();            addStu.stuAdd(Sname.getText(), Ssex.getText(), Sbirth.getText(), Sethnic.getText(), Shometown.getText(), Sdate.getText(), Smajor.getText(), Scollege.getText());             this.setNull();            Sno.setText(getSno.getNewStuId());        } else if (obj == clearStuInformationButton) { //���            setNull();            Sno.setText("" + getSno.getNewStuId());            //JOptionPane.showMessageDialog(null, "已清空!");        }    }      public static void main(String args[]) {        java.awt.EventQueue.invokeLater(new Runnable() {            public void run() {                new AddStuInformation().setVisible(true);            }        });    }}

⌨️ 快捷键说明

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