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

📄 classframe.java

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

package caoyu;//班级管理系统

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

public class ClassFrame 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();
  JTextField jTextField6 = new JTextField();
  
  JButton jButton1 = new JButton();
  JButton jButton2 = new JButton();
  JButton jButton3 = new JButton();
  JButton jButton4 = new JButton();

  public ClassFrame() {
     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));
     jLabel4.setText("人数");
     jLabel4.setBounds(29, 107, 64, 38);
     jLabel4.setVerifyInputWhenFocusTarget(true);
     jLabel5.setFont(new java.awt.Font("Dialog", 0, 18));   
     jLabel5.setText("建班时间");
     jLabel5.setBounds(29, 160, 75, 38);
     jLabel6.setFont(new java.awt.Font("Dialog", 0, 18));
     jLabel6.setText("班长姓名");
     jLabel6.setBounds(new Rectangle(277, 163, 75, 38));    
     jLabel7.setFont(new java.awt.Font("Dialog", 0, 18));
     jLabel7.setText("专业");
     jLabel7.setBounds(25, 212, 64, 38);
     //jLabel8.setText("专业");
     //jLabel8.setBounds(25, 212, 64, 38);
     
     jTextField1.setText("");
     jTextField1.setBounds(112, 73, 131, 24);
     jTextField6.setText("");
     jTextField6.setBounds(112, 107, 131, 24);
     
     /*jRadioButton1.setFont(new java.awt.Font("Dialog", 0, 18));
     jRadioButton1.setText("  男 ");
     jRadioButton1.setBounds(122, 117, 73, 19);
     jRadioButton2.setFont(new java.awt.Font("Dialog", 0, 18));
     jRadioButton2.setText("  女");
     jRadioButton2.setBounds(232, 117, 73, 19);
     bg.add(jRadioButton1);
     bg.add(jRadioButton2);*/
     
     jTextField2.setText("");
     jTextField2.setBounds(342, 73, 136, 24);
     jTextField3.setText("");
     jTextField3.setBounds(108, 168, 131, 24);
     jTextField4.setText("");
     jTextField4.setBounds(351, 165, 131, 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)
     	    {                                                      //增加班级
     	       Classes cla = new Classes();
               cla.classno  = jTextField1.getText().trim();
               cla.departmentno  = jTextField2.getText().trim();
               
               cla.gross_number   = jTextField6.getText().trim();
               cla.enter_date   = jTextField3.getText().trim();
               cla.monitor   = jTextField4.getText().trim();
               cla.major   = jTextField5.getText().trim();
               DBOperatorStudent op = new DBOperatorStudent();
               op.addClass(cla);
               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) 
     	   {                                                      //查询班级信息
     	      ClassTable a =new ClassTable();
     	      
     	   }
     	}  
     );
     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(jTextField1.getText().trim().equals("")) {
     	         JOptionPane.showMessageDialog(null,"给出要删除的班号 ",
			         "WARING",JOptionPane.WARNING_MESSAGE);
	          }
	          else { 
     	         DBOperatorStudent op = new DBOperatorStudent();
     	         op.deleteClass(jTextField1.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(jTextField6, 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[]) {
     ClassFrame frame = new ClassFrame();
     frame.setSize(510,370);
     frame.setVisible(true);
  }
}

⌨️ 快捷键说明

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