Java学习者论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

手机号码,快捷登录

恭喜Java学习者论坛(https://www.javaxxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,购买链接:点击进入购买VIP会员
JAVA高级面试进阶视频教程Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程

Go语言视频零基础入门到精通

Java架构师3期(课件+源码)

Java开发全终端实战租房项目视频教程

SpringBoot2.X入门到高级使用教程

大数据培训第六期全套视频教程

深度学习(CNN RNN GAN)算法原理

Java亿级流量电商系统视频教程

互联网架构师视频教程

年薪50万Spark2.0从入门到精通

年薪50万!人工智能学习路线教程

年薪50万!大数据从入门到精通学习路线年薪50万!机器学习入门到精通视频教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程 MySQL入门到精通教程
查看: 467|回复: 0

[默认分类] Java 基于MySQL数据库的简单学生管理系统

[复制链接]
  • TA的每日心情
    开心
    2021-12-13 21:45
  • 签到天数: 15 天

    [LV.4]偶尔看看III

    发表于 2018-3-20 13:59:35 | 显示全部楼层 |阅读模式

    因为实验室要交作业然后就做了一个学生管理系统  贴个代码纪念一下~
    做的太急界面什么的也比较差
    还有一些小细节没有完善不过还是能实现主要的功能的~

    Window是主界面

    1. package First;
    2. import java.sql.*;
    3. import java.awt.*;
    4. import java.awt.event.*;
    5. import javax.swing.*;
    6. public class Window {
    7.    public static void main(String[] args){
    8.            JFrame jframe = new JFrame("学生管理系统") ; //window
    9.            Dimension d = new Dimension(400,300);
    10.            Point p = new Point (250,350);
    11.           
    12.            jframe.setSize(d);
    13.            jframe.setLocation(p);
    14.            jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    15.            jframe.setVisible(true);
    16.           
    17.            JButton button1 = new JButton("添加");
    18.            JButton button2 = new JButton("修改");
    19.            JButton button3 = new JButton("查询");
    20.            JButton button4 = new JButton("删除");
    21.            JButton button5 = new JButton("浏览");
    22.           
    23.            FlowLayout flow = new FlowLayout(FlowLayout.LEFT,10,10);
    24.            JPanel panel = new JPanel(flow);
    25.            panel.add(button1);
    26.            panel.add(button2);
    27.            panel.add(button3);
    28.            panel.add(button4);
    29.            panel.add(button5);
    30.           
    31.            jframe.add(panel);
    32.           
    33.            button1.addActionListener(new ActionListener(){
    34.                         public void actionPerformed(ActionEvent e){
    35.                                 Add add = new Add();
    36.                         }                       
    37.                 });
    38.           
    39.            button2.addActionListener(new ActionListener(){
    40.                         public void actionPerformed(ActionEvent e){
    41.                                 Change change = new Change();                       
    42.                         }                       
    43.                 });
    44.           
    45.            button3.addActionListener(new ActionListener(){
    46.                         public void actionPerformed(ActionEvent e){
    47.                                 Ask ask = new Ask();                       
    48.                         }                       
    49.                 });
    50.           
    51.            button4.addActionListener(new ActionListener(){
    52.                         public void actionPerformed(ActionEvent e){
    53.                                 Delete delete = new Delete();                       
    54.                         }                       
    55.                 });
    56.           
    57.            button5.addActionListener(new ActionListener(){
    58.                         public void actionPerformed(ActionEvent e){
    59.                                 Look look = new Look();                       
    60.                         }                       
    61.                 });
    62.           
    63.    }
    64. }
    复制代码

    Add是添加


    1. package First;
    2. import java.sql.*;
    3. import java.awt.*;
    4. import java.awt.event.*;
    5. import javax.swing.*;
    6. import com.mysql.jdbc.Driver;
    7. import First.Window;
    8. public class Add extends JFrame {
    9.         private static final long serialVersionUID = -1928970409928880648L;
    10.        
    11.         JLabel jlnumber = new JLabel("学号:");
    12.         JLabel jlname = new JLabel("姓名:");
    13.         JLabel jlsex = new JLabel("性别:");
    14.         JLabel jlbirthday = new JLabel("出生日期:");
    15.         JLabel jldepartment = new JLabel("学院:");
    16.        
    17.         JTextField jtnumber = new JTextField("",20);
    18.         JTextField jtname = new JTextField("",20);
    19.         JTextField jtsex = new JTextField("",20);
    20.         JTextField jtbirthday = new JTextField("",20);
    21.         JTextField jtdepartment = new JTextField("",20);
    22.        
    23.         JButton buttonadd = new JButton("添加");
    24.         JButton buttonreturn = new JButton("返回");
    25.        
    26.        
    27.         public Add() {
    28.                 JPanel jpnumber = new JPanel();
    29.                 JPanel jpname = new JPanel();
    30.                 JPanel jpsex = new JPanel();
    31.                 JPanel jpbirthday = new JPanel();
    32.                 JPanel jpdepartment = new JPanel();
    33.                 JPanel jpforbutton = new JPanel(new GridLayout(1,1));
    34.                
    35.                 jpnumber.add(jlnumber);
    36.                 jpnumber.add(jtnumber);
    37.                
    38.                 jpname.add(jlname);
    39.                 jpname.add(jtname);
    40.                
    41.                 jpsex.add(jlsex);
    42.                 jpsex.add(jtsex);
    43.                
    44.                 jpbirthday.add(jlbirthday);
    45.                 jpbirthday.add(jtbirthday);
    46.                
    47.                 jpdepartment.add(jldepartment);
    48.                 jpdepartment.add(jtdepartment);
    49.                
    50.                 jpforbutton.add(buttonadd);
    51.                 jpforbutton.add(buttonreturn);
    52.                
    53.                 buttonadd.addActionListener(new ActionListener(){
    54.                         public void actionPerformed(ActionEvent e){
    55.                                
    56.                                 //Add
    57.                                 Connection conn = null;
    58.                                 Statement stat = null;
    59.                                 PreparedStatement ps=null;
    60.                                 String sql = "INSERT INTO student(number,name,sex,birthday,department) "
    61.                                                 + "values(?,?,?,?,?)";
    62.                                 try{
    63.                                         Class.forName("Driver");
    64.                                         System.out.println("JBDC 加载成功!");
    65.                                 }catch(Exception a){
    66.                                         System.out.println("JBDC 狗带!");
    67.                                         a.printStackTrace();
    68.                                 }
    69.                                 try{
    70.                                         conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/javaStu","root","123");
    71.                                         ps=conn.prepareStatement(sql);
    72.                                        
    73.                                         ps.setString(1,jtnumber.getText());
    74.                                         ps.setString(2,jtname.getText());
    75.                                         ps.setString(3,jtsex.getText());
    76.                                         ps.setString(4,jtbirthday.getText());
    77.                                         ps.setString(5,jtdepartment.getText());
    78.                                         ps.executeUpdate();
    79.                                        
    80.                                         //System.out.println("MySQL 连接成功!");
    81.                                         //stat = conn.createStatement();
    82.                                         //stat.executeUpdate(sql);
    83.                                         //System.out.println("插入数据成功!");
    84.                                        
    85.                                 }catch (SQLException b){
    86.                                         b.printStackTrace();
    87.                                 }finally{
    88.                                         try{
    89.                                                 conn.close();
    90.                                                 System.out.println("MySQL 关闭成功");
    91.                                         }catch (SQLException c){
    92.                                                 System.out.println("MySQL 关闭失败 ");
    93.                                                 c.printStackTrace();
    94.                                         }
    95.                                        
    96.                                 }
    97.                                        
    98.                                        
    99.                 }}       
    100.                
    101.                                 );
    102.                
    103.                 buttonreturn.addActionListener(new ActionListener(){
    104.                         public void actionPerformed(ActionEvent e){
    105.                                 Window window = new Window();                       
    106.                         }                       
    107.                 });
    108.                
    109.                
    110.                 this.setTitle("添加学生信息");
    111.                 this.setLayout(new GridLayout(9,1));
    112.                 this.add(jpnumber);
    113.                 this.add(jpname);
    114.                 this.add(jpsex);
    115.                 this.add(jpbirthday);
    116.                 this.add(jpdepartment);
    117.                 this.add(jpforbutton);
    118.                 this.setLocation(400,300);
    119.                 this.setSize(350,300);
    120.                 this.setVisible(true);
    121.                
    122.         }
    123.        
    124.        
    125. }
    复制代码





    Ask是查询

    1. package First;
    2. import java.sql.*;
    3. import java.awt.*;
    4. import java.awt.event.*;
    5. import javax.swing.*;
    6. import First.Window;
    7. public class Ask extends JFrame {
    8.         private static final long serialVersionUID = -1928970409928880648L;
    9.        
    10.         JLabel jlnumber = new JLabel("学号:");
    11.         JLabel jlname = new JLabel("姓名:");
    12.         JLabel jlsex = new JLabel("性别:");
    13.         JLabel jlbirthday = new JLabel("出生日期:");
    14.         JLabel jldepartment = new JLabel("学院:");
    15.        
    16.         JTextField jtnumber = new JTextField("",20);
    17.         JLabel jname = new JLabel();
    18.         JLabel jsex = new JLabel();
    19.         JLabel jbirthday = new JLabel();
    20.         JLabel jdepartment = new JLabel();
    21.        
    22.         JButton buttonask = new JButton("查询");
    23.         JButton buttonreturn = new JButton("返回");
    24.        
    25.        
    26.         public Ask() {
    27.                 JPanel jpnumber = new JPanel();
    28.                 JPanel jpname = new JPanel();
    29.                 JPanel jpsex = new JPanel();
    30.                 JPanel jpbirthday = new JPanel();
    31.                 JPanel jpdepartment = new JPanel();
    32.                 JPanel jpforbutton = new JPanel(new GridLayout(1,1));
    33.                
    34.                 jpnumber.add(jlnumber);
    35.                 jpnumber.add(jtnumber);
    36.                
    37.                 jpname.add(jlname);
    38.                 jpname.add(jname);
    39.                
    40.                 jpsex.add(jlsex);
    41.                 jpsex.add(jsex);
    42.                
    43.                 jpbirthday.add(jlbirthday);
    44.                 jpbirthday.add(jbirthday);
    45.                
    46.                 jpdepartment.add(jldepartment);
    47.                 jpdepartment.add(jdepartment);
    48.                
    49.                 jpforbutton.add(buttonask);
    50.                 jpforbutton.add(buttonreturn);
    51.                
    52.                 buttonask.addActionListener(new ActionListener(){
    53.                         public void actionPerformed(ActionEvent e){
    54.                                 Connection conn = null;
    55.                                 ResultSet res = null;
    56.                                 Statement stat = null;
    57.                                
    58.                                 String sql = "SELECT number,name,sex,birthday,department FROM student;";
    59.                                 try{
    60.                                         Class.forName("com.mysql.jdbc.Driver");
    61.                                        
    62.                                 }catch(Exception d){
    63.                                         System.out.println("jdbc fall");
    64.                                         d.printStackTrace();
    65.                                 }
    66.                                 try{
    67.                                         conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/javaStu","root","123");
    68.                                         stat=conn.createStatement();
    69.                                         res=stat.executeQuery(sql);
    70.                                         while (res.next())
    71.                                         {
    72.                                                 if (res.getString(1).equals(jtnumber.getText()))
    73.                                                 {
    74.                                                         jname.setText(res.getString(2));
    75.                                                         jsex.setText(res.getString(3));
    76.                                                         jbirthday.setText(res.getString(4));
    77.                                                         jdepartment.setText(res.getString(5));
    78.                                                         break;
    79.                                                 }
    80.                                         }
    81.                                 }catch (SQLException e1) {
    82.                                         // TODO Auto-generated catch block
    83.                                         e1.printStackTrace();
    84.                                
    85.                                
    86.                         }
    87.                                 finally{
    88.                                         try{
    89.                                                 conn.close();
    90.                                         }catch(SQLException ar){
    91.                                                 ar.printStackTrace();
    92.                                         }
    93.                        
    94.                                 }}}
    95.                        
    96.                                 );
    97.                
    98.                 buttonreturn.addActionListener(new ActionListener(){
    99.                         public void actionPerformed(ActionEvent e){
    100.                                 Window window = new Window();                       
    101.                         }                       
    102.                 });
    103.                
    104.                
    105.                 this.setTitle("查询学生信息");
    106.                 this.setLayout(new GridLayout(9,1));
    107.                 this.add(jpnumber);
    108.                 this.add(jpname);
    109.                 this.add(jpsex);
    110.                 this.add(jpbirthday);
    111.                 this.add(jpdepartment);
    112.                 this.add(jpforbutton);
    113.                 this.setLocation(400,300);
    114.                 this.setSize(350,300);
    115.                 this.setVisible(true);
    116.                
    117.                
    118.         }
    119.        
    120.        
    121. }
    复制代码





    Change是修改

    1. package First;
    2. import java.sql.*;
    3. import java.awt.*;
    4. import java.awt.event.*;
    5. import javax.swing.*;
    6. import First.Window;
    7. public class Change extends JFrame {
    8.         private static final long serialVersionUID = -1928970409928880648L;
    9.        
    10.         JLabel jlnumber = new JLabel("学号:");
    11.         JLabel jlname = new JLabel("姓名:");
    12.         JLabel jlsex = new JLabel("性别:");
    13.         JLabel jlbirthday = new JLabel("出生日期:");
    14.         JLabel jldepartment = new JLabel("学院:");
    15.        
    16.         JTextField jtnumber = new JTextField("",20);
    17.         JTextField jtname = new JTextField("",20);
    18.         JTextField jtsex = new JTextField("",20);
    19.         JTextField jtbirthday = new JTextField("",20);
    20.         JTextField jtdepartment = new JTextField("",20);
    21.        
    22.         JButton buttonchange = new JButton("修改");
    23.         JButton buttonreturn = new JButton("返回");
    24.        
    25.        
    26.         public Change() {
    27.                 JPanel jpnumber = new JPanel();
    28.                 JPanel jpname = new JPanel();
    29.                 JPanel jpsex = new JPanel();
    30.                 JPanel jpbirthday = new JPanel();
    31.                 JPanel jpdepartment = new JPanel();
    32.                 JPanel jpforbutton = new JPanel(new GridLayout(1,1));
    33.                
    34.                 jpnumber.add(jlnumber);
    35.                 jpnumber.add(jtnumber);
    36.                
    37.                 jpname.add(jlname);
    38.                 jpname.add(jtname);
    39.                
    40.                 jpsex.add(jlsex);
    41.                 jpsex.add(jtsex);
    42.                
    43.                 jpbirthday.add(jlbirthday);
    44.                 jpbirthday.add(jtbirthday);
    45.                
    46.                 jpdepartment.add(jldepartment);
    47.                 jpdepartment.add(jtdepartment);
    48.                
    49.                 jpforbutton.add(buttonchange);
    50.                 jpforbutton.add(buttonreturn);
    51.                
    52.                 buttonchange.addActionListener(new ActionListener(){
    53.                         public void actionPerformed(ActionEvent e){
    54.                                 String number = jtnumber.getText();
    55.                                 String name = jtname.getText();
    56.                                 String sex = jtsex.getText();
    57.                                 String birthday = jtbirthday.getText();
    58.                                 String department = jtdepartment.getText();
    59.                                
    60.                                 Connection conn = null;
    61.                                 ResultSet res = null;
    62.                                 Statement stat = null;
    63.                                
    64.                                 String sql = "SELECT number,name,sex,birthday,department FROM student;";
    65.                                 try{
    66.                                         Class.forName("com.mysql.jdbc.Driver");
    67.                                        
    68.                                 }catch(Exception d){
    69.                                         System.out.println("jdbc fall");
    70.                                         d.printStackTrace();
    71.                                 }
    72.                                 try{
    73.                                         conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/javaStu","root","123");
    74.                                         stat=conn.createStatement();
    75.                                         res=stat.executeQuery(sql);
    76.                                         while (res.next())
    77.                                         {
    78.                                                 //change
    79.                                                 if (res.getString(1).equals(jtnumber.getText()))
    80.                                                 {
    81.                         try{
    82.                                                         Class.forName("com.mysql.jdbc.Driver");
    83.                                                 }catch(Exception d){
    84.                                                         System.out.println("jdbc fall");
    85.                                                         d.printStackTrace();
    86.                                                 }
    87.                                                        
    88.                                                         String sql2="UPDATE student SET name=""+name+""  WHERE number=""+jtnumber.getText()+""";
    89.                                                         String sql3="UPDATE student SET sex=""+sex+""  WHERE number=""+jtnumber.getText()+""";
    90.                                                         String sql4="UPDATE student SET birthday=""+birthday+""  WHERE number=""+jtnumber.getText()+""";
    91.                                                         String sql5="UPDATE student SET department=""+department+""  WHERE number=""+jtnumber.getText()+""";
    92.                                                         try {
    93.                                                                 conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/javaStu","root","123");
    94.                                                                 stat=conn.createStatement();
    95.                                                                 stat.executeUpdate(sql2);
    96.                                                                 stat.executeUpdate(sql3);
    97.                                                                 stat.executeUpdate(sql4);
    98.                                                                 stat.executeUpdate(sql5);
    99.                                                         } catch (SQLException g) {
    100.                                                                 // TODO Auto-generated catch block
    101.                                                                 g.printStackTrace();
    102.                                                         }try{
    103.                                                                 stat.close();
    104.                                                                 conn.close();
    105.                                                         }catch(SQLException ar){
    106.                                                                 ar.printStackTrace();
    107.                                                 }
    108.                                                         break;
    109.                                                 }
    110.                                                
    111.                                         //change end
    112.                                         }
    113.                                 }catch (SQLException e1) {
    114.                                         // TODO Auto-generated catch block
    115.                                         e1.printStackTrace();
    116.                                
    117.                                
    118.                         }
    119.                                 finally{
    120.                                         try{
    121.                                                 conn.close();
    122.                                         }catch(SQLException ar){
    123.                                                 ar.printStackTrace();
    124.                                         }
    125.                        
    126.                                 }
    127.                                
    128.                         }
    129.                        
    130.                        
    131.                 });
    132.                
    133.                
    134.                 buttonreturn.addActionListener(new ActionListener(){
    135.                         public void actionPerformed(ActionEvent e){
    136.                                 Window window = new Window();                       
    137.                         }                       
    138.                 });
    139.                
    140.                 this.setTitle("修改学生信息");
    141.                 this.setLayout(new GridLayout(9,1));
    142.                 this.add(jpnumber);
    143.                 this.add(jpname);
    144.                 this.add(jpsex);
    145.                 this.add(jpbirthday);
    146.                 this.add(jpdepartment);
    147.                 this.add(jpforbutton);
    148.                 this.setLocation(400,300);
    149.                 this.setSize(350,300);
    150.                 this.setVisible(true);
    151.                
    152.                
    153.         }
    154.        
    155.        
    156. }
    复制代码





    Delete是删除

    1. package First;
    2. import java.sql.*;
    3. import java.awt.*;
    4. import java.awt.event.*;
    5.    import javax.swing.*;
    6. import First.Window;
    7.    public class Delete extends JFrame {
    8.                 private static final long serialVersionUID = -1928970409928880648L;
    9.                                   
    10.                 JLabel jlnumber = new JLabel("学号:");
    11.                
    12.                 JTextField jtnumber = new JTextField("",20);
    13.                
    14.                 JButton buttondelete = new JButton("删除");
    15.                 JButton buttonreturn = new JButton("返回");
    16.                
    17.                
    18.                 public Delete() {
    19.                         JPanel jpnumber = new JPanel();
    20.                         JPanel jpforbutton = new JPanel(new GridLayout(1,1));
    21.                        
    22.                         jpnumber.add(jlnumber);
    23.                         jpnumber.add(jtnumber);
    24.                        
    25.                         jpforbutton.add(buttondelete);
    26.                         jpforbutton.add(buttonreturn);
    27.                        
    28.                         buttondelete.addActionListener(new ActionListener(){
    29.                                 public void actionPerformed(ActionEvent e){
    30.                                         String number = jtnumber.getText();
    31.                                        
    32.                                         Connection conn = null;
    33.                                         ResultSet res = null;
    34.                                         Statement stat = null;
    35.                                         String sql = "DELETE FROM student WHERE number=""+number+""";
    36.                                        
    37.                                         try{
    38.                                                 Class.forName("com.mysql.jdbc.Driver");
    39.                                         }catch(Exception a){
    40.                                                 a.printStackTrace();
    41.                                         }
    42.                                         try{
    43.                                                 conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/javaStu","root","123");
    44.                                                 stat = conn.createStatement();
    45.                                                 stat.executeUpdate(sql);
    46.                                         }catch(SQLException h){
    47.                                                 h.printStackTrace();
    48.                                                
    49.                                         }finally{
    50.                                                 try{
    51.                                                         conn.close();
    52.                                                         System.out.println("close success!");
    53.                                                 }catch(SQLException j){
    54.                                                         System.out.println("close go die!");
    55.                                                     j.printStackTrace();
    56.                                                 }
    57.                                                
    58.                                         }
    59.                                        
    60.                                 }
    61.                                
    62.                                
    63.                         });
    64.                        
    65.                         buttonreturn.addActionListener(new ActionListener(){
    66.                                 public void actionPerformed(ActionEvent e){
    67.                                         Window window = new Window();                       
    68.                                 }                       
    69.                         });
    70.                        
    71.                        
    72.                         this.setTitle("删除学生信息");
    73.                         this.setLayout(new GridLayout(9,1));
    74.                         this.add(jpnumber);
    75.                         this.add(jpforbutton);
    76.                         this.setLocation(400,300);
    77.                         this.setSize(350,300);
    78.                         this.setVisible(true);
    79.                        
    80.                        
    81.                 }
    82.                
    83.             
    84.             
    85.         }
    86.        
    87.        
    复制代码





    Look是浏览

    1. package First;
    2. import java.sql.*;
    3. import java.awt.*;
    4. import java.awt.event.*;
    5. import javax.swing.*;
    6. import java.util.*;
    7. import First.Window;
    8. public class Look extends JFrame {
    9.         private static final long serialVersionUID = -1928970409928880648L;
    10.        
    11.         Connection conn = null;
    12.         PreparedStatement ps = null;
    13.         ResultSet res = null;
    14.        
    15.        
    16.         //JButton buttonlook = new JButton("浏览");
    17.         //JButton buttonreturn = new JButton("返回");
    18.        
    19.         JTable jtable;
    20.         JScrollPane jscrollpane = new JScrollPane();
    21.        
    22.         Vector columnNames = null;
    23.         Vector rowData = null;
    24.        
    25.         public Look() {
    26.                 JPanel jpforbutton = new JPanel(new GridLayout(1,1));
    27.                 columnNames = new Vector();
    28.                 columnNames.add("学号");
    29.                 columnNames.add("姓名");
    30.                 columnNames.add("性别");
    31.                 columnNames.add("出生日期");
    32.                 columnNames.add("学院");
    33.                 rowData = new Vector();
    34.                
    35.                 //jpforbutton.add(buttonlook);
    36.                 //jpforbutton.add(buttonreturn);
    37.                
    38.                
    39.                 try {
    40.                         Class.forName("com.mysql.jdbc.Driver");
    41.                         conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/javaStu","root","123");
    42.                         ps = conn.prepareStatement("SELECT * FROM student");
    43.                         res = ps.executeQuery();
    44.                         while (res.next())
    45.                         {
    46.                                 Vector hang = new Vector();
    47.                                 hang.add(res.getString(1));
    48.                                 hang.add(res.getString(2));
    49.                                 hang.add(res.getString(3));
    50.                                 hang.add(res.getString(4));
    51.                                 hang.add(res.getString(5));
    52.                                 rowData.add(hang);
    53.                                
    54.                         }
    55.                         System.out.println("load  ok!");
    56.                 }catch (Exception q){
    57.                         q.printStackTrace();
    58.                         System.out.println("go die");
    59.                 }finally{
    60.                         try{
    61.                                 res.close();
    62.                                 ps.close();
    63.                                 conn.close();
    64.                                 System.out.println("close ok");
    65.                         }catch (SQLException o){
    66.                                 o.printStackTrace();
    67.                                 System.out.println("go die 2");
    68.                         }
    69.                 }
    70.                
    71.                
    72.                
    73.                
    74.                 jtable = new JTable(rowData,columnNames);
    75.                 jscrollpane = new JScrollPane(jtable);
    76.                
    77.                 this.add(jscrollpane);
    78.                 this.setTitle("浏览学生信息");
    79.                 this.setLayout(new GridLayout(2,5));
    80.                 this.add(jpforbutton);
    81.                 this.setLocation(300,300);
    82.                 this.setSize(500,300);
    83.                 this.setVisible(true);
    84.                 this.setResizable(false);
    85.                
    86.         }
    87.        
    88.        
    89. }
    复制代码




    一些运行的界面~










    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|Java学习者论坛 ( 声明:本站资料整理自互联网,用于Java学习者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2024-5-21 08:15 , Processed in 0.339109 second(s), 36 queries .

    Powered by Discuz! X3.4

    © 2001-2017 Comsenz Inc.

    快速回复 返回顶部 返回列表