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

📄 teainfo.java

📁 班级管理系统
💻 JAVA
字号:
package lab.lab;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class TeaInfo extends JFrame implements ActionListener{
	Container contentPane;
	JPanel centerPanel =new JPanel();
	JPanel upPanel=new JPanel();
	JPanel downPanel=new JPanel();
	Dimension faceSize=new Dimension(800,500);
	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();
	JLabel jlabel8=new JLabel();
	JLabel jlabel9=new JLabel();
	JTextField tNum=new JTextField(15);
	JTextField tName=new JTextField(15);
	JTextField tSex=new JTextField(15);
	JTextField tSethnic=new JTextField(15);
	JTextField tCollege=new JTextField(15);
	JTextField tMajor=new JTextField(15);
	JTextField tHome=new JTextField(46);
	
	JButton searchInfo=new JButton();
	JButton addInfo=new JButton();
	JButton deleteInfo=new JButton();
	JButton modifyInfo=new JButton();
	JButton clearInfo=new JButton();
	JButton saveInfo=new JButton();
	JButton exitInfo=new JButton();
	GridBagLayout gridBag=new GridBagLayout();
	GridBagConstraints gridBagCon;
	public TeaInfo(){
		this.setSize(faceSize);
		this.setTitle("教师管理信息");
		this.setResizable(false);
        try{
        	Init();
        }
        catch(Exception e){
        	e.printStackTrace();
        }
	}
	public void Init()throws Exception{
		contentPane=this.getContentPane();
		contentPane.setLayout(new BorderLayout());
		centerPanel.setLayout(gridBag);
		jlabel1.setText("工                 号");
		jlabel1.setFont(new Font("Dialog",0,12));
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=0;
		gridBagCon.gridy=0;
		gridBagCon.insets=new Insets(10,10,10,1);
		gridBag.setConstraints(jlabel1,gridBagCon);
		centerPanel.add(jlabel1);
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=1;
		gridBagCon.gridy=0;
		gridBagCon.insets=new Insets(10,1,10,15);
		gridBag.setConstraints(tNum,gridBagCon);
		centerPanel.add(tNum);
		
		jlabel2.setText("姓                 名");
		jlabel2.setFont(new Font("Dialog",0,12));
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=2;
		gridBagCon.gridy=0;
		gridBagCon.insets=new Insets(10,15,10,1);
		gridBag.setConstraints(jlabel2,gridBagCon);
		centerPanel.add(jlabel2);
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=3;
		gridBagCon.gridy=0;
		gridBagCon.insets=new Insets(10,1,10,10);
		gridBag.setConstraints(tName,gridBagCon);
		centerPanel.add(tName);
		
		jlabel3.setText("性                 别");
		jlabel3.setFont(new Font("Dialog",0,12));
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=0;
		gridBagCon.gridy=1;
		gridBagCon.insets=new Insets(10,10,10,1);
		gridBag.setConstraints(jlabel3,gridBagCon);
		centerPanel.add(jlabel3);
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=1;
		gridBagCon.gridy=1;
		gridBagCon.insets=new Insets(10,1,10,15);
		gridBag.setConstraints(tSex,gridBagCon);
		centerPanel.add(tSex);
		
		jlabel4.setText("民                 族");
		jlabel4.setFont(new Font("Dialog",0,12));
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=2;
		gridBagCon.gridy=1;
		gridBagCon.insets=new Insets(10,15,10,1);
		gridBag.setConstraints(jlabel4,gridBagCon);
		centerPanel.add(jlabel4);
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=3;
		gridBagCon.gridy=1;
		gridBagCon.insets=new Insets(10,1,10,10);
		gridBag.setConstraints(tSethnic,gridBagCon);
		centerPanel.add(tSethnic);
		
		jlabel7.setText("学                 院");
		jlabel7.setFont(new Font("Dialog",0,12));
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=0;
		gridBagCon.gridy=3;
		gridBagCon.insets=new Insets(10,10,10,1);
		gridBag.setConstraints(jlabel7,gridBagCon);
		centerPanel.add(jlabel7);
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=1;
		gridBagCon.gridy=3;
		gridBagCon.insets=new Insets(10,1,10,15);
		gridBag.setConstraints(tCollege,gridBagCon);
		centerPanel.add(tCollege);
		
		jlabel8.setText("专                 业");
		jlabel8.setFont(new Font("Dialog",0,12));
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=2;
		gridBagCon.gridy=3;
		gridBagCon.insets=new Insets(10,15,10,1);
		gridBag.setConstraints(jlabel8,gridBagCon);
		centerPanel.add(jlabel8);
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=3;
		gridBagCon.gridy=3;
		gridBagCon.insets=new Insets(10,1,10,10);
		gridBag.setConstraints(tMajor,gridBagCon);
		centerPanel.add(tMajor);
		
		jlabel9.setText("籍                 贯");
		jlabel9.setFont(new Font("Dialog",0,12));
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=0;
		gridBagCon.gridy=4;
		gridBagCon.insets=new Insets(10,10,10,1);
		gridBag.setConstraints(jlabel9,gridBagCon);
		centerPanel.add(jlabel9);
		gridBagCon=new GridBagConstraints();
		gridBagCon.gridx=1;
		gridBagCon.gridy=4;
		gridBagCon.gridwidth=3;
		gridBagCon.insets=new Insets(10,1,10,10);
		gridBag.setConstraints(tHome,gridBagCon);
		centerPanel.add(tHome);
		
		contentPane.add(centerPanel,BorderLayout.CENTER);
		
		tNum.setEditable(false);
		tName.setEditable(false);
		tSex.setEditable(false);
		tSethnic.setEditable(false);
		tMajor.setEditable(false);
		tCollege.setEditable(false);
		tHome.setEditable(false);	
	}
	public void downInit(){
		searchInfo.setText("查询");
		searchInfo.setFont(new Font("Dialog",0,12));
		downPanel.add(searchInfo);
		addInfo.setText("增加");
		addInfo.setFont(new Font("Dialog",0,12));
		downPanel.add(addInfo);
		modifyInfo.setText("修改");
		modifyInfo.setFont(new Font("Dialog",0,12));
		downPanel.add(modifyInfo);
		deleteInfo.setText("删除");
		deleteInfo.setFont(new Font("Dialog",0,12));
		downPanel.add(deleteInfo);
		saveInfo.setText("保存");
		saveInfo.setFont(new Font("Dialog",0,12));
		downPanel.add(saveInfo);
		clearInfo.setText("清空");
		clearInfo.setFont(new Font("Dialog",0,12));
		downPanel.add(clearInfo);
		exitInfo.setText("退出");
		exitInfo.setFont(new Font("Dialog",0,12));
		downPanel.add(exitInfo);
		contentPane.add(downPanel,BorderLayout.SOUTH);
		
		searchInfo.addActionListener(this);
		addInfo.addActionListener(this);
		modifyInfo.addActionListener(this);
		deleteInfo.addActionListener(this);
		saveInfo.addActionListener(this);
		clearInfo.addActionListener(this);
		exitInfo.addActionListener(this);
		
		modifyInfo.setEnabled(false);
		deleteInfo.setEnabled(false);
		saveInfo.setEnabled(false);
		clearInfo.setEnabled(false);
	}
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		Object obj=e.getSource();
		if(obj==searchInfo){			
		}
		else if(obj==addInfo){
		}
		else if(obj==modifyInfo){			
		}
		else if(obj==deleteInfo){
		}
		else if(obj==saveInfo){
		}
		else if(obj==clearInfo){
			setNull();
		}
		else if(obj==exitInfo){
			this.dispose();
		}
	}
	void setNull(){
		tNum.setText(null);
		tName.setText(null);
		tSex.setText(null);
		tSethnic.setText(null);
		tMajor.setText(null);
		tCollege.setText(null);
		tHome.setText(null);
	}
}

⌨️ 快捷键说明

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