searchforstudetail.java

来自「学生学籍管理系统」· Java 代码 · 共 316 行

JAVA
316
字号
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 SearchForStuDetail implements ActionListener
 { 

    JDialog jfm; 
     

    JTabbedPane jplForFrame=new JTabbedPane(); 
        
    JLabel tell=new JLabel("查找学籍信息",JLabel.CENTER);
    
    panelForSearchId_4 pfsi;
    panelForSearchName_4 pfsn;
    panelForSearchSex_4 pfss;
    panelForSearchAge_4 pfsa;
    
   SearchForStuDetail(JFrame f,String s,boolean b)
   {
   	
  
   	jfm=new JDialog(f,s,b);
    jfm.setSize(450,220);
    
    jfm.setBackground(Color.white);
    pfsi= new panelForSearchId_4(f,b);
    pfsn= new panelForSearchName_4(f,b);
    pfss = new panelForSearchSex_4(f,b);
    pfsa = new panelForSearchAge_4(f,b);
    
    jfm.addWindowListener(new WindowAdapter()
      {public void windowClosing(WindowEvent e)
       {
         jfm.setVisible(false);
       }});
    jfm.setResizable(false);
 
    jplForFrame.setBackground(Color.white);
    jplForFrame.addTab("按帐号查找",pfsi);
    jplForFrame.addTab("按姓名查找",pfsn);
    jplForFrame.addTab("按姓别查找",pfss);
    jplForFrame.addTab("按楼号查找",pfsa);

    pfsi.cancel.addActionListener(this);
    pfsn.cancel.addActionListener(this);
    pfss.cancel.addActionListener(this);
    pfsa.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()==pfsi.cancel){
     	this.setDisplay(false);
     }
     
     else if(e.getSource()==pfsn.cancel){
     	this.setDisplay(false);
     }
        
     else if(e.getSource()==pfss.cancel){
     	this.setDisplay(false);
     }
     
     else if(e.getSource()==pfsa.cancel){
     	this.setDisplay(false);
     }
   	}
   

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


class panelForSearchId_4 extends JPanel implements ActionListener
{
	 //   framForSearch ffs;//查找界面
	JPanel contentPane_1,contentPane_3;
    
    JLabel du_id=new JLabel("输入学号",JLabel.CENTER); 
    JTextField jf_id=new JTextField("",8);  

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

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

    	contentPane_1=new JPanel();
    	contentPane_3=new JPanel();
    	
    	contentPane_1.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));
    	contentPane_1.add(du_id);
    	contentPane_1.add(jf_id);  	

	    
	   contentPane_3.setLayout(new FlowLayout(FlowLayout.CENTER));
	   contentPane_3.add(handin);
	   contentPane_3.add(cancel);

	   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){
     
     	}
     	    	
    }
 }
 
 class panelForSearchName_4 extends JPanel implements ActionListener
{
	 //   framForSearch ffs;//查找界面
	JPanel contentPane_1,contentPane_3;
    
    JLabel du_id=new JLabel("输入姓名",JLabel.CENTER); 
    JTextField jf_id=new JTextField("",8);  

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

    	contentPane_1=new JPanel();
    	contentPane_3=new JPanel();
    	
    	contentPane_1.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));
    	contentPane_1.add(du_id);
    	contentPane_1.add(jf_id);  	
    
	   contentPane_3.setLayout(new FlowLayout(FlowLayout.CENTER));
	   contentPane_3.add(handin);
	   contentPane_3.add(cancel);

	    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){
     
     	}
     	    	
    }
 }


class panelForSearchSex_4 extends JPanel implements ActionListener,ItemListener
{
	 //   framForSearch ffs;//查找界面
	JPanel contentPane_1,contentPane_3;
    
    JRadioButton jrb_male=new JRadioButton("男");
    JRadioButton jrb_female=new JRadioButton("女"); 
    ButtonGroup sex= new ButtonGroup();
	JButton handin = new JButton("提交");
	JButton cancel = new JButton("退出");
	
	proceeSQL psql=new proceeSQL();
	String onesex ="男";
    
   panelForSearchSex_4(JFrame f,boolean b){

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

    	contentPane_1=new JPanel();
    	contentPane_3=new JPanel();

    	JPanel pnl=new JPanel();
        sex.add(jrb_male);
        sex.add(jrb_female);

    	pnl.add(new JLabel("选择姓别:",JLabel.CENTER));
        pnl.add(jrb_male);
        pnl.add(jrb_female);
    	contentPane_1.add(pnl);
        jrb_male.addItemListener(this);
        jrb_female.addItemListener(this);
       

    	contentPane_1.setLayout(new GridLayout(2,2,9,9));

    	
	   contentPane_3.setLayout(new FlowLayout(FlowLayout.CENTER));
	   contentPane_3.add(handin);
	   contentPane_3.add(cancel);
	    
	   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){
           
     	}
     	
    }
    
    public String getSex(){
    	return onesex;
    }
    
    public void itemStateChanged(ItemEvent e){
	 	
   	 	if(e.getItemSelectable()==jrb_male){
   	 	onesex = "男";
   	 	}
   	 	
   	 	else if(e.getItemSelectable()==jrb_female){
   	 	onesex = "女";
   	 	}
   	 }
 }


class panelForSearchAge_4 extends JPanel implements ActionListener
{

	 //   framForSearch ffs;//查找界面
	JPanel contentPane_1,contentPane_3;
    Choice age = new Choice();
 

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

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

    	contentPane_1=new JPanel();
    	contentPane_3=new JPanel();
    	          
       for(int i=0;i<10;i++)
         age.addItem(""+(i+1));
       
       	contentPane_1.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));
       	contentPane_1.add(new JLabel("选择楼号:",JLabel.CENTER));
    	contentPane_1.add(age);  	
	    
	    	
	    contentPane_3.setLayout(new FlowLayout(FlowLayout.CENTER));
	    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 + =
减小字号Ctrl + -
显示快捷键?