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

📄 departmentframe.java

📁 这个是我二年级写的一个教务管理系统 大家可以下来
💻 JAVA
字号:
// StudentFrame.java

package caoyu;//学生管理系统

import javax.swing.table.AbstractTableModel;
import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class DepartmentFrame extends JFrame {
	
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  JLabel jLabel4 = new JLabel();
  JLabel jLabel5 = new JLabel();
  JLabel jLabel6 = new JLabel();
  JLabel jLabel7 = new JLabel();
  
  ButtonGroup bg = new ButtonGroup();
  JRadioButton jRadioButton1 = new JRadioButton();
  JRadioButton jRadioButton2 = new JRadioButton();
  
  JTextField jTextField1 = new JTextField();
  JTextField jTextField2 = new JTextField();
  JTextField jTextField3 = new JTextField();
  JTextField jTextField4 = new JTextField();
  JTextField jTextField5 = new JTextField();
  
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();
  JButton jButton3 = new JButton();
  JButton jButton4 = new JButton();

  public DepartmentFrame() {
     try {
        jbInit();
     }
     catch(Exception ex) {
        ex.printStackTrace();
     }
  }

  public void jbInit() throws Exception {
  	 Container container = this.getContentPane();
  	 container.setLayout(null);
  	 
     jLabel1.setFont(new java.awt.Font("Dialog", 1, 24));
     jLabel1.setText("院系管理系统");
     jLabel1.setBounds(151, 20, 244, 44);
     jLabel2.setFont(new java.awt.Font("Dialog", 0, 18));
     jLabel2.setText("系名");
     jLabel2.setBounds(30, 66, 64, 38);
     jLabel3.setFont(new java.awt.Font("Dialog", 0, 18));
     jLabel3.setText("系号");
     jLabel3.setBounds(280, 67, 64, 38);
     jLabel4.setFont(new java.awt.Font("Dialog", 0, 18));
     
     jLabel7.setFont(new java.awt.Font("Dialog", 0, 18));
     jLabel7.setText("系主任");
     jLabel7.setBounds(25, 212, 64, 38);
     
     jTextField1.setText("");
     jTextField1.setBounds(112, 73, 131, 24);
     
     
     jTextField2.setText("");
     jTextField2.setBounds(342, 73, 136, 24);

     jTextField5.setText("");
     jTextField5.setBounds(105, 214, 377, 24);
     
     jButton1.setBounds(50, 262, 98, 35);
     jButton1.setFont(new java.awt.Font("Dialog", 0, 16));
     jButton1.setText("增加");
     jButton1.setBorder(BorderFactory.createEtchedBorder());
     jButton1.addActionListener(
     	 new ActionListener() {
     	    public void actionPerformed(ActionEvent event)
     	    {                                                 //增加
     	       Students stu = new Students();
               stu.sname = jTextField1.getText().trim();
               stu.sno = jTextField2.getText().trim();
               if(jRadioButton1.isSelected())
                  stu.ssex = "男";
               else 
                  stu.ssex = "女";
               stu.classno = jTextField3.getText().trim();
               stu.birthday = jTextField4.getText().trim();
               stu.address = jTextField5.getText().trim();
               DBOperatorStudent op = new DBOperatorStudent();
               op.addStudent(stu);
               JOptionPane.showMessageDialog(null,"增加",
			      "result",JOptionPane.PLAIN_MESSAGE);
			   jTextField1.setText(null);
			   jTextField2.setText(null);
			   jTextField3.setText(null);
			   jTextField4.setText(null);
			   jTextField5.setText(null);	
     	    }	
     	 }
     );
     
     jButton2.setBounds(164, 263, 98, 35);
     jButton2.setFont(new java.awt.Font("Dialog", 0, 16));
     jButton2.setText("查询");
     jButton2.setBorder(BorderFactory.createEtchedBorder());
     jButton2.addActionListener(                                         //查询
     	new ActionListener() {
     	   public void actionPerformed(ActionEvent event)
     	   {  
     	      DepartmentTable a=new DepartmentTable();
     	   }
     	}  
     );
     jButton3.setBounds(278, 262, 98, 35);
     jButton3.setFont(new java.awt.Font("Dialog", 0, 16));
     jButton3.setText("删除");
     jButton3.setBorder(BorderFactory.createEtchedBorder());
     jButton3.addActionListener(
     	new ActionListener() {
     	   public void actionPerformed(ActionEvent event)
     	   {                                                              //删除
     	      if(jTextField2.getText().trim().equals("")) {
     	         JOptionPane.showMessageDialog(null,"要删学号 ",
			         "WARING",JOptionPane.WARNING_MESSAGE);
	          }
	          else { 
     	         DBOperatorStudent op = new DBOperatorStudent();
     	         op.deleteStudnet(jTextField2.getText().trim());
     	         JOptionPane.showMessageDialog(null,"删除",
			         "result",JOptionPane.PLAIN_MESSAGE);
			     jTextField2.setText(null);
			  } 	
     	   }	
     	}
     );
     
     jButton4.setBounds(393, 260, 98, 35);
     jButton4.setFont(new java.awt.Font("Dialog", 0, 16));
     jButton4.setText("退出");
     jButton4.setBorder(BorderFactory.createEtchedBorder());
     jButton4.addActionListener(
     	new ActionListener() {
     	   public void actionPerformed(ActionEvent event)
     	   {                                                          //退出
     	      System.exit(0);   	
     	   }	
     	}
     );
     
     container.add(jLabel1, null);
     container.add(jLabel2, null);
     container.add(jTextField1, null);
     container.add(jLabel3, null);
     container.add(jTextField2, null);
     container.add(jLabel4, null);
     container.add(jRadioButton1, null);
     container.add(jRadioButton2, null);
     container.add(jLabel5, null);
     container.add(jTextField3, null);
     container.add(jLabel6, null);
     container.add(jTextField4, null);
     container.add(jLabel7, null);
     container.add(jTextField5, null);
     container.add(jButton1, null);
     container.add(jButton2, null);
     container.add(jButton3, null);
     container.add(jButton4, null);
     setSize(510,370);
     setVisible(true);
  }
 public static void main(String args[]) {
     DepartmentFrame frame = new DepartmentFrame();
     frame.setSize(510,370);
     frame.setVisible(true);
  }
}

⌨️ 快捷键说明

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