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

📄 info_manage.java

📁 学生信息管理系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
<信息综合管理界面、程序代码---添加、修改、删除基本信息>
*/
package myprojects.info_system;

import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import java.util.*;
import javax.swing.table.*;


class Info_manage_Dialog extends JFrame 
{
	JPanel contentPane;
  	BorderLayout borderLayout1 = new BorderLayout();
  	JPanel jPanel1 = new JPanel();
  	JButton jButton_Add = new JButton();
  	JButton jButton_Cancel = new JButton();
  	JButton jButton_Close = new JButton();
  	JButton jButton_Search = new JButton();
  	JButton jButton_Edit = new JButton();
  	JButton jButton_Del = new JButton();

  	JPanel jPanel2 = new JPanel();
  	JLabel jLabel_Num = new JLabel();
  	JTextField jTextField_Num = new JTextField();
  	JLabel jLabel_Race = new JLabel();
  	JTextField jTextField_Race = new JTextField();
  	JLabel jLabel_Name = new JLabel();
  	JLabel jLabel_Phone = new JLabel();
  	JTextField jTextField_Name = new JTextField();
  	JTextField jTextField_Phone = new JTextField();
  	JLabel jLabel_Sex = new JLabel();
  	JLabel jLabel_Email = new JLabel();
  	JLabel jLabel_Home = new JLabel();
  	JTextField jTextField_Sex = new JTextField();
  	JTextField jTextField_Email = new JTextField();
  	JTextField jTextField_Home = new JTextField();
  	JLabel jLabel_Profession = new JLabel();
  	JTextField jTextField_Profession = new JTextField();
  	JLabel jLabel_Address = new JLabel();
  	JTextField jTextField_Address = new JTextField();
  	GridBagLayout gridBagLayout1 = new GridBagLayout();
  
  	public Info_manage_Dialog(String Type_Dialog) 
  	{
    	try {
      			//setDefaultCloseOperation(EXIT_ON_CLOSE);
      			jbInit(Type_Dialog);
    		}catch (Exception exception) 
    		{
      			exception.printStackTrace();
    		}
  	}

  	public void jbInit(String Type_Dialog) throws Exception 
  	{
		contentPane = (JPanel) getContentPane();
    	contentPane.setLayout(borderLayout1);
    	
    	//************************** 注册事件监听**** 通过接口实现 *****************
    	jButton_Add.setText("添加");
    	jButton_Add.addActionListener(new Info_manage_Dialog_jButton_Add_actionAdapter(this));
    	jButton_Cancel.setText("取消");
    	jButton_Cancel.addActionListener(new Info_manage_Dialog_jButton_Cancel_actionAdapter(this));
    	jButton_Close.setText("关闭");
    	jButton_Close.addActionListener(new Info_manage_Dialog_jButton_Close_actionAdapter(this));
    	jButton_Search.setText("查询");
    	jButton_Search.addActionListener(new Info_manage_Dialog_jButton_Search_actionAdapter(this));
    	jButton_Del.setText("删除");
    	jButton_Del.addActionListener(new Info_manage_Dialog_jButton_Del_actionAdapter(this));
    	jButton_Edit.setText("修改");
    	jButton_Edit.addActionListener(new Info_manage_Dialog_jButton_Edit_actionAdapter(this));

		//*****************************
    	jLabel_Num.setText("学号 *");
    	jTextField_Num.setText("");
    	jLabel_Race.setText("民族");
    	jTextField_Race.setText("");
    	jPanel2.setLayout(gridBagLayout1);
    	jLabel_Name.setText("姓名");
    	jLabel_Phone.setText("电话");
    	jTextField_Name.setText("");
    	jTextField_Phone.setText("");
    	jLabel_Sex.setText("性别");
    	jLabel_Email.setText("E_mail");
    	jLabel_Home.setText("籍贯");
    	jTextField_Sex.setText("");
    	jTextField_Email.setText("");
    	jTextField_Home.setText("");
    	jLabel_Profession.setToolTipText("");
    	jLabel_Profession.setText("专业");
    	jTextField_Profession.setText("");
    	jLabel_Address.setToolTipText("");
    	jLabel_Address.setText("地址");
    	jTextField_Address.setText("");
    	contentPane.add(jPanel1, java.awt.BorderLayout.SOUTH);
    	
    	//********* 判断属于哪一个界面要求 根据要求组装面板****
    	if(Type_Dialog.equals("Add_Dialog"))
    	{
    		setTitle("Add_Dialog");
    		jPanel1.add(jButton_Add);
    		jPanel1.add(jButton_Cancel);
    		jPanel1.add(jButton_Close);
    	}
    	if(Type_Dialog.equals("Del_Dialog"))
    	{
    		setTitle("Del_Dialog");
    		jPanel1.add(jButton_Search);
    		jPanel1.add(jButton_Del);
    		jPanel1.add(jButton_Close);
    	}
    	if(Type_Dialog.equals("Edit_Dialog"))
		{
    		setTitle("Edit_Dialog");
	    	jPanel1.add(jButton_Search);
    		jPanel1.add(jButton_Edit);
    		jPanel1.add(jButton_Close);	
		}
		  
		//********************************************  
    	contentPane.add(jPanel2, java.awt.BorderLayout.CENTER);
    	jPanel2.add(jTextField_Address, new GridBagConstraints(1, 4, 3, 1, 1.0, 0.0
        	, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
        	new Insets(18, 0, 36, 49), 212, 0));
    	jPanel2.add(jLabel_Address, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0
        	, GridBagConstraints.WEST,
        	GridBagConstraints.NONE,
        	new Insets(20, 42, 36, 0), 12,
        	0));
    	jPanel2.add(jLabel_Profession, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0
        	, GridBagConstraints.WEST,
        	GridBagConstraints.NONE,
        	new Insets(32, 13, 0, 0), 12, 0));
    	jPanel2.add(jTextField_Profession,
                new GridBagConstraints(3, 3, 1, 1, 1.0, 0.0
                                       , GridBagConstraints.WEST,
                                       GridBagConstraints.HORIZONTAL,
                                       new Insets(29, 0, 0, 49), 50, 0));
    	jPanel2.add(jTextField_Home, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0
        	, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
        	new Insets(26, 0, 0, 0), 50, 0));
    	jPanel2.add(jLabel_Home, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
        	, GridBagConstraints.WEST,
        	GridBagConstraints.NONE,
        	new Insets(26, 42, 6, 0), 12, 0));
    	jPanel2.add(jLabel_Email, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
        	, GridBagConstraints.WEST,
        	GridBagConstraints.NONE,
        	new Insets(31, 13, 0, 0), 4, 0));
    	jPanel2.add(jTextField_Email, new GridBagConstraints(3, 2, 1, 1, 1.0, 0.0
        	, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
        	new Insets(28, 0, 0, 49), 50, 0));
    	jPanel2.add(jTextField_Sex, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0
        	, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
        	new Insets(26, 0, 0, 0), 50, 0));
    	jPanel2.add(jLabel_Sex, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
        	, GridBagConstraints.WEST,
        	GridBagConstraints.NONE,
       		new Insets(23, 42, 8, 0), 12, 0));
    	jPanel2.add(jLabel_Phone, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
        	, GridBagConstraints.WEST,
        	GridBagConstraints.NONE,
        	new Insets(33, 13, 0, 0), 12, 0));
    	jPanel2.add(jTextField_Phone, new GridBagConstraints(3, 1, 1, 1, 1.0, 0.0
        	, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
        	new Insets(30, 0, 0, 49), 50, 0));
    	jPanel2.add(jTextField_Name, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0
        	, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
        	new Insets(28, 0, 0, 0), 50, 0));
    	jPanel2.add(jLabel_Name, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
        	, GridBagConstraints.WEST,
        	GridBagConstraints.NONE,
        	new Insets(27, 42, 6, 0), 12, 0));
    	jPanel2.add(jLabel_Num, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
        	, GridBagConstraints.WEST,
       		GridBagConstraints.NONE,
        	new Insets(28, 42, 0, 0), 12, 0));
    	jPanel2.add(jTextField_Num, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0
        	, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
        	new Insets(28, 0, 0, 0), 50, 0));
    	jPanel2.add(jLabel_Race, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
        	, GridBagConstraints.WEST,
        	GridBagConstraints.NONE,
        	new Insets(28, 13, 0, 12), 0, 0));
    	jPanel2.add(jTextField_Race, new GridBagConstraints(3, 0, 1, 1, 1.0, 0.0
        	, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
        	new Insets(28, 0, 0, 49), 50, 0));
        
    	setSize(new Dimension(400, 300));
    	//setTitle("Frame Title");

  	}
  
  	//*********************** 事件对应的行为 **************
  	public void jButton_Add_actionPerformed(ActionEvent e) 
  	{
    	Info_manage_Method("Add");
  	}

  	public void jButton_Cancel_actionPerformed(ActionEvent e) 
  	{
    	Info_manage_Method("Cancel");
  	}
  
  	public void jButton_Search_actionPerformed(ActionEvent e) 
  	{
		Info_manage_Method("Search");
  	}

  	public void jButton_Del_actionPerformed(ActionEvent e) 
  	{
    	Info_manage_Method("Del");
  	}

  	public void jButton_Edit_actionPerformed(ActionEvent e) 
  	{
    	Info_manage_Method("Edit");
  	}

  	public void jButton_Close_actionPerformed(ActionEvent e) 
  	{
    	Info_manage_Method("Close");
  	}
  
  	//************************ 实现上述行为的代码 *******************
  	public void Info_manage_Method(String action) 
  	//Include "Add,Cancel,Search,Del,Edit,Close"

⌨️ 快捷键说明

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