• 大小: 3KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: Java
  • 标签: Java  

资源简介

JavaAWT和MySQL实现学生信息管理系统,Java和MySQL实现学生信息管理系统

资源截图

代码片段和文件信息

package com.edu.imau;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.Jframe;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.text.BadLocationException;

public class StudentInfoManager extends Jframe {

    private static final long serialVersionUID = 1L;

    private JPanel panel;
    private JButton button1 button2 button3;
    private JTextArea text1 text2 text3;
    private String[] top={“id““name““age“};
    private static String[][] data=new String[20][3];
    JTable table = new JTable(data top);  
    JScrollPane scrollPane  = new JScrollPane(table);
    //table.setFillsViewportHeight(true); 


    public StudentInfoManager() throws BadLocationException SQLException {
        super(“学生信息管理系统“);
        this.setSize(500 340);
        findInfo();

        this.add(scrollPane BorderLayout.CENTER);
        this.add(getJPanel() BorderLayout.SOUTH);
        this.setResizable(true);
        this.setLocation(300 300);
        this.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
    }
    private JPanel getJPanel() {
        if (panel == null) {
            panel = new JPanel();
            panel.setLayout(new GridLayout(2 3));
            text1 = new JTextArea();
            text2 = new JTextArea();
            text3 = new JTextArea();
            button1 = new JButton(“add“);
            button2 = new JButton(“delete“);
            button3 = new JButton(“update“);
            button1.addActionListener(new insert());
            button2.addActionListener(new delete());
            button3.addActionListener(new update());
            text1.setBorder(BorderFactory.createLineBorder(Color.gray 2));
            text2.setBorder(BorderFactory.createLineBorder(Color.gray 2));
            text3.setBorder(BorderFactory.createLineBorder(Color.gray 2));
            text1.setFont(new Font(“宋体“ Font.BOLD 16));
            text2.setFont(new Font(“宋体“ Font.BOLD 16));
            text3.setFont(new Font(“宋体“ Font.BOLD 16));
            text1.setText(“id“);
            text2.setText(“name“);
            text3.setText(“age“);
            panel.add(text1);
            panel.add(text2);
            panel.add(text3);
            panel.add(button1);
            panel.add(button2);
            panel.add(button3);

        }
        return panel;

    }
    class insert implements ActionListener{

        public void actionPerformed(ActionEvent e) {
            if(text1.getText().equals(“ “)||text2.getTex

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        619  2017-04-08 09:35  1学生信息管理系统\stu.sql

     文件       8220  2017-04-08 09:33  1学生信息管理系统\StudentInfoManager.java

     目录          0  2017-04-08 09:35  1学生信息管理系统

----------- ---------  ---------- -----  ----

                 8839                    3


评论

共有 条评论