資源簡介
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
- 上一篇:jni數值傳遞
- 下一篇:協同過濾推薦系統 Java
評論
共有 條評論