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

📄 change.java

📁 学生信息管理系统,能显示登录,管理,查询,增添删除等功能
💻 JAVA
字号:
//修改用户密码的界面
package com.yanjun;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
public class change extends JFrame{
	JLabel  L1=new JLabel("用户名称");
    JTextField txt=new JTextField(20);
    JLabel  L2=new JLabel("用户密码");
    JPasswordField pass1 = new JPasswordField(20);
    JLabel  L3=new JLabel("新密码");
    JPasswordField pass2 = new JPasswordField(20);
    String [] types={"学生","教师"};
    JComboBox cb=new JComboBox();
    JButton b1=new JButton("修改");
    JButton b2=new JButton("取消");
    
    ActionListener a1 = new ActionListener() 
    {
      public void actionPerformed(ActionEvent e)
	  {   
    	  String id1=txt.getText();
    	  String id2=pass1.getText();
    	  String id3=pass2.getText();
    	  int num=cb.getSelectedIndex();
	      if(!id2.equals(id3)){
	    	  if(num==0)
	    	  {
	    		if(link.check1(id1,id2)){
	    		if(changecode.change1(id1,id3))
	    		JOptionPane.showMessageDialog(null, 
	    		"修改密码成功", "提示信息", 
	    	    JOptionPane.ERROR_MESSAGE);
	    		
	    		if(!(changecode.change1(id1,id3)))
	    	    JOptionPane.showMessageDialog(null, 
	    		"修改密码不成功", "提示错误信息", 
	    	    JOptionPane.ERROR_MESSAGE);
	    	   }
	    	   else JOptionPane.showMessageDialog(null, 
	    	     "你输入的用户无效", "提示错误信息", 
	    	      JOptionPane.ERROR_MESSAGE);
	    	   }
	    	  if(num==1)
	    	  {
	    		  if(link.check2(id1,id2)){
	  	    		if(changecode.change2(id1,id3))
	  	    		JOptionPane.showMessageDialog(null, 
	  	    		"修改密码成功", "提示信息", 
	  	    	    JOptionPane.ERROR_MESSAGE);
	  	    		if(!(changecode.change2(id1,id3)))
	  	    	    JOptionPane.showMessageDialog(null, 
	  	    		"修改密码不成功", "提示错误信息", 
	  	    	    JOptionPane.ERROR_MESSAGE);
	  	    		  }
	  	    		  else JOptionPane.showMessageDialog(null, 
	  	    	     "你输入的用户无效", "提示错误信息", 
	  	    	      JOptionPane.ERROR_MESSAGE); 	    	  
	    	  }  
	      }  
	      else JOptionPane.showMessageDialog(null, 
                  "你输入的密码与原密码重复", "提示信息", 
                  JOptionPane.ERROR_MESSAGE);
	      
	  }
    };
    ActionListener a2 = new ActionListener() 
    {
      public void actionPerformed(ActionEvent e)
	  {
   	   dispose();
	  }
    };
    public change()
    {
    	super("修改密码");
    	Container cp=getContentPane();
    	cp.setLayout(new FlowLayout());
    	for(int i=0;i<types.length;i++)
        cb.addItem(types[i]);
    	cp.add(L1);
    	cp.add(txt);
    	cp.add(L2);
    	cp.add(pass1);
    	cp.add(L3);
    	cp.add(pass2);
    	cp.add(cb);
    	cp.add(b1);
    	cp.add(b2);
    	b1.addActionListener(a1);
    	b2.addActionListener(a2);
    	setSize(300,150);
    	show();
    }
}

⌨️ 快捷键说明

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