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

📄 welcome.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 Welcome extends JPanel 
{  
   Font fontword = new Font("楷体_GB2312",Font.BOLD,26);
   Font Passfont= new Font("楷体_GB2312",Font.BOLD,32);
   Welcome me=this;
   JFrame c=null;
   JLabel Title1=new JLabel(new ImageIcon(".\\gif\\title1.gif"));
   JLabel Title2=new JLabel(new ImageIcon(".\\gif\\title2.gif"));
   Font lblfont=new Font("Serif",Font.BOLD,20);
   JLabel l1=new JLabel("请插入ATM卡(插入软盘,点刷卡)");
   JLabel l2=new JLabel("卡号:");
   JLabel l3=new JLabel("请输入密码:");
   JLabel CardPic = new JLabel(new ImageIcon(".\\gif\\atmcard1.jpg"));
   public JButton btConfirm=new JButton("确定");
   JButton btCancel=new JButton("退卡");
   JPasswordField txtPass = new JPasswordField(new PasswordRestrict(6,btConfirm),"",6);
   JTextField txtCardID = new JTextField(10);
   
   Component f;
   CustomerThread st;
   ReadAtmID CardReader;
   private ActionListener listener=new ActionResponse();
   public Welcome (Component ComponentF,CustomerThread s)
   {
   	f=ComponentF;
   	st=s;
   	this.setLayout(null);
   	
    txtPass.setBounds(230,145,120,25);
    Title1.setBounds(35,5,200,60);
    Title2.setBounds(240,12,215,60);
    l1.setBounds(50,70,400,30);
    l2.setBounds(160,110,100,30);
    l3.setBounds(80,140,180,30);
    txtCardID.setBounds(230,115,120,25);
    l3.setFont(fontword);
    l1.setFont(fontword);
    l2.setFont(fontword);
    txtPass.setFont(Passfont);
    txtCardID.setFont(fontword);
    txtCardID.setEditable(false);
    l2.setForeground(Color.blue);
    txtCardID.setForeground(Color.red);
    l1.setForeground(Color.red);
    l3.setForeground(Color.blue);
    CardPic.setBounds(90,180,200,150);
    this.add(l1);
    this.add(l2);
    this.add(l3);
    this.add(txtCardID);
    this.add(txtPass);
    this.add(btConfirm);
    this.add(btCancel);
    this.add(CardPic);
    this.add(Title1);
    this.add(Title2);
    btConfirm.setBounds(380,230,100,30);
    btCancel.setBounds(380,270,100,30);
    btConfirm.addActionListener(listener);
   	btCancel.addActionListener(listener);
   	txtPass.addActionListener(listener);
    btConfirm.setFont(fontword);
   	btCancel.setFont(fontword);
   	btConfirm.setEnabled(false);
   	
   }
   public void ReadAtm()
   {
   	   CardReader = new ReadAtmID(f);
   	   txtCardID.setText(String.valueOf(CardReader.ReadCardID(btConfirm)));
   	   l2.setVisible(true);
   	   l3.setVisible(true);
   	   txtPass.setVisible(true);
   	   txtCardID.setVisible(true);
   }
   public void Init_State()
   {
   	  l1.setText("请插入ATM卡(插入软盘,点刷卡)");
   	  l2.setVisible(false);
   	  l3.setVisible(false);
   	  txtCardID.setText("");
   	  txtPass.setText("");
   	  btConfirm.setEnabled(false);
   	  
   	  
   }

   
   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("确定"))
	    {
	       //st.SendQuary();
	       try{
	           st.SendQuary(txtCardID.getText(),String.valueOf(txtPass.getPassword()),me);
	          }
	          catch(IOException exp)
	          {}
        }      
      }
   }
}	 
	           
 

⌨️ 快捷键说明

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