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

📄 addcoursemuch.java

📁 学生学籍管理系统
💻 JAVA
字号:
package E4;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Vector;
import java.io.File;
import java.io.*;
import java.util.StringTokenizer;
import javax.swing.table.*;
import java.sql.*;

 //显示信息
class addCourseMuch implements ActionListener
 { 

    JDialog jfm; 
     

    JTabbedPane jplForFrame=new JTabbedPane(); 
        
    JLabel tell=new JLabel("选课",JLabel.CENTER); 
    panelForAddCourseByClasses pfacbcl; 
    panelForAddCourseByCollege pfacbco;
    
   addCourseMuch(JFrame f,String s,boolean b)
   {
   	
  

   	jfm=new JDialog(f,s,b);
    jfm.setSize(410,220);
    jfm.setBackground(Color.white);
    pfacbco = new panelForAddCourseByCollege(f,b);
    pfacbcl = new panelForAddCourseByClasses(f,b);
    
    jfm.addWindowListener(new WindowAdapter()
      {public void windowClosing(WindowEvent e)
       {
         jfm.setVisible(false);
       }});
    jfm.setResizable(false);
 
    jplForFrame.setBackground(Color.white);
    jplForFrame.addTab("按班级添加选课信息",pfacbcl);
    jplForFrame.addTab("按院系添加选课信息",pfacbco);

    pfacbcl.cancel.addActionListener(this);
    pfacbco.cancel.addActionListener(this);
    jfm.setLayout(new BorderLayout(9,9));
    jfm.add(jplForFrame);
    tell.setBackground(Color.BLACK);   
    jfm.add(tell,BorderLayout.NORTH);
   

   }
   
   public void actionPerformed(ActionEvent e){
      if(e.getSource()==pfacbcl.cancel){
      	this.setDisplay(false);
      }
      
      else if(e.getSource()==pfacbco.cancel){
      	this.setDisplay(false);
      }
   	}
   

    void setDisplay(Boolean tf){
   	jfm.setVisible(tf);
   }
   	
}


class panelForAddCourseByClasses extends JPanel implements ActionListener
{
	 //   framForSearch ffs;//查找界面
	JPanel contentPane_1,contentPane_3;
    
    Choice college = new Choice();
    Choice classes = new Choice();

    JTextField cno = new JTextField("",7);
	JButton handin = new JButton("提交");
	JButton cancel = new JButton("退出");
	
	proceeSQL psql=new proceeSQL();
    
   panelForAddCourseByClasses(JFrame f,boolean b){

    //	ffs = new framForSearch(f,"查找用户信息",b);

    	contentPane_1=new JPanel();
    	contentPane_3=new JPanel();
    //计算机科学与技术,网络工程,软件工程,会计学,国际贸易,光电子,机械自动化,环境工程	
    	college.addItem("计算机科学与技术");
    	college.addItem("网络工程");
    	college.addItem("软件工程");
    	college.addItem("会计学");
    	college.addItem("国际贸易");
    	college.addItem("光电子");
    	college.addItem("机械自动化");
    	college.addItem("环境工程");

    	for(int i=3;i<7;i++)
    	  for(int j=0;j<4;j++)
    	    classes.addItem("计算机科学与技术0"+i+(j+1)+"班");
    	
    	contentPane_1.add(new JLabel("选择院系:",JLabel.CENTER));
    	contentPane_1.add(college);
    	contentPane_1.add(new JLabel("选择班级:",JLabel.CENTER));  	
    	contentPane_1.add(classes);

    	contentPane_1.setLayout(new GridLayout(2,2,9,9));
        
  	
	   contentPane_3.setLayout(new FlowLayout(FlowLayout.CENTER));
	   contentPane_3.add(new JLabel("输入课序号:"));
	    contentPane_3.add(cno);
	   contentPane_3.add(handin);
	   contentPane_3.add(cancel);
	    
	    handin.addActionListener(this);
	    cancel.addActionListener(this);
	    
	    super.setLayout(new BorderLayout(9,9));
	    super.add(new JLabel("按班级为学生选课",JLabel.CENTER),BorderLayout.NORTH);
	    super.add(contentPane_1);
	    super.add(contentPane_3,BorderLayout.SOUTH);;
    	
    }
    
  void addIntoClasses(String college){
  	   classes.removeAll();
  	  	for(int i=3;i<7;i++)
    	  for(int j=0;j<4;j++)
    	    classes.addItem(college+"0"+i+(j+1)+"班");
  }
    
       
  public void actionPerformed(ActionEvent e){
     	
     	if(e.getSource()==cancel){
           
     	}
     
    }
 }


class panelForAddCourseByCollege extends JPanel implements ActionListener
{

	 //   framForSearch ffs;//查找界面
	JPanel contentPane_1,contentPane_3;
    Choice college = new Choice();
    JTextField cno = new JTextField("",7);

	JButton handin = new JButton("提交");
	JButton cancel = new JButton("退出");
	
	proceeSQL psql=new proceeSQL();
    
   panelForAddCourseByCollege(JFrame f,boolean b){

    //	ffs = new framForSearch(f,"查找用户信息",b);

    	contentPane_1=new JPanel();
    	contentPane_3=new JPanel();
    	          
      	college.addItem("计算机科学与技术");
    	college.addItem("网络工程");
    	college.addItem("软件工程");
    	college.addItem("会计学");
    	college.addItem("国际贸易");
    	college.addItem("光电子");
    	college.addItem("机械自动化");
    	college.addItem("环境工程");
       
       	contentPane_1.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));
       	contentPane_1.add(new JLabel("选择院系:",JLabel.CENTER));
    	contentPane_1.add(college);  	
	    
	    	
	    contentPane_3.setLayout(new FlowLayout(FlowLayout.CENTER));
	    contentPane_3.add(new JLabel("输入课序号:"));
	    contentPane_3.add(cno);
	    contentPane_3.add(handin);
	    contentPane_3.add(cancel); 
	    
	    handin.addActionListener(this);
	    cancel.addActionListener(this);
	    
	    super.setLayout(new BorderLayout(9,9));
	    super.add(new JLabel("按院系为学生选课",JLabel.CENTER),BorderLayout.NORTH);
	    super.add(contentPane_1);
	    super.add(contentPane_3,BorderLayout.SOUTH);;
    	
    }
    
     public void actionPerformed(ActionEvent e){
     	
     	if(e.getSource()==cancel){
  
     	}
     	      	
     	  	 	
     	}
    }
  



⌨️ 快捷键说明

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