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

📄 passwordpane.java

📁 课程设计:ATM Project源码
💻 JAVA
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.Locale;
import java.util.Date;
import java.sql.*;
import java.text.*;
import javax.swing.border.*;
import java.io.*;
import java.net.*;
public class PasswordPane extends JPanel 
{  
   JFrame c=null;
   CustomerThread st;
   Font fontword = new Font("Serif",Font.BOLD,18);
   JLabel l1=new JLabel("    卡  号:");
   JLabel l2=new JLabel("   新密码:");
   JLabel l3=new JLabel("重复密码:");
   JLabel Title=new JLabel(new ImageIcon(".\\title\\password.gif"));
   Font font=new Font("Serif",Font.BOLD,30);
   JTextField txtCard= new JTextField(10);
   JPasswordField txtNew= new JPasswordField(10);
   JPasswordField txtAgain= new JPasswordField(10);
   JButton btConfirm=new JButton("修改");
   JButton btCancel=new JButton("重输");
   JButton btBack=new JButton("返回");
   JButton btCalc=new JButton("计算器");
   Icon img=new ImageIcon(".\\gif\\ts.gif");
   JLabel tsGif=new JLabel(img);
   Component f;
   private ActionListener listener=new ActionResponse();
   public PasswordPane (Component ComponentF,CustomerThread s)
   {
   	f=ComponentF;
   	st=s;
   	this.setLayout(null);
   
   	tsGif.setBounds(80,50,80,80);
    l1.setBounds(80,80,100,30);
   	l2.setBounds(80,110,100,30);
    l3.setBounds(80,140,100,30);
    l1.setFont(fontword);
    l2.setFont(fontword);
    l3.setFont(fontword);
    l1.setForeground(Color.blue);
    l2.setForeground(Color.blue);
    l3.setForeground(Color.blue);

    txtCard.setBounds(180,85,150,20);
   	txtNew.setBounds(180,115,150,20);
   	txtAgain.setBounds(180,145,150,20);
   	txtCard.setFont(fontword);
   	txtNew.setFont(fontword);
   	txtAgain.setFont(fontword);
   	btConfirm.setBounds(380,180,100,30);
   	btCancel.setBounds(380,220,100,30);
   	btBack.setBounds(380,260,100,30);
   	btCalc.setBounds(380,300,100,30);
   	btConfirm.setFont(fontword);
   	btCancel.setFont(fontword);
   	btBack.setFont(fontword);
   	btCalc.setFont(fontword);
   	Title.setBounds(5,20,490,50);
   	Title.setForeground(Color.red);
   	Title.setFont(font);
   	this.add(Title);
   	btConfirm.addActionListener(listener);
   	btCancel.addActionListener(listener);
   	btBack.addActionListener(listener);
   	btCalc.addActionListener(listener);
    //this.add(tsGif);
    txtCard.setEditable(false);
   	this.add(l1);
   	this.add(l2);
   	this.add(l3);
   	this.add(txtCard);
   	this.add(txtNew);
   	this.add(txtAgain);
   	this.add(btConfirm);
   	this.add(btCancel);
   	this.add(btBack);
   	this.add(btCalc);
   }
   class ActionResponse implements ActionListener
   {
   	public void actionPerformed (ActionEvent e) 
    {
	 String cmd = e.getActionCommand();
	 if (cmd.equals("计算器"))
     {
	   if(c==null) {
         c=new CalculatorFrame();
         c.show();
       }
       else c.show();
     }
       if (cmd.equals("重输"))
    {
    	txtCard.setText("");
    	txtNew.setText("");
    	txtAgain.setText("");
    }
    if (cmd.equals("修改"))
    {
    	String title = "请确定";
        int type = JOptionPane.INFORMATION_MESSAGE;
        String[] options={"修改","取消"};
        int optionType=JOptionPane.YES_NO_OPTION;
        int messageType=JOptionPane.QUESTION_MESSAGE; 
        String message = "真的要修改您ATM卡的的密码?";
        int result = JOptionPane.showOptionDialog(f,message, title, optionType,messageType,null,options,options[1]);
        if (result == JOptionPane.YES_OPTION)
    {	
        if ((String.valueOf(txtNew.getPassword()).equals(String.valueOf(txtAgain.getPassword()))))
        {
          try{
            	st.SendPass(String.valueOf(txtNew.getPassword()));
             }
             catch(IOException exp)
             {}	
        }
        else
        
        JOptionPane.showMessageDialog(f,"重设密码二次输入不一致,请重输!", "警告:", JOptionPane.INFORMATION_MESSAGE);
    }    
            
    }
  }
}
}
  
		
	

⌨️ 快捷键说明

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