ATM Machine Simulator

                    ATM Machine Simulator
                                          Final Project


               
 

                    Click Here to Download Runnable ATM Machine Simulator with source code



Source Code




CLASS DDPSP14BSE005G2A1
/*********************
 * Arslan ud Din Shafiq
 * DDP-SP14-BSE-005
 * Group-2
 * Section-A
 * CIIT ,Lahore & Lancaster, UK
 * Assignment # 3 & 4
 * ---------------------
 * Details of My Program
 * ---------------------
 * Initially all buttons can not be accessed.
 * To access all the buttons you have to Insert ATM card.
 * After inserting ATM card, you will press "Inserted Button(a button with CARD pic)".
 * After pressing CARD Pic button, other buttons will be enabled & they will start work.
 * To test the program you have to use default pin code which is 1234.
 * For testing purposes, you can check initially without depositing any money.
 * Initial balance is by-default set to "0".
 * So, without depositing money, if you will try to pay bill or funds transfer or withdraw cash,
 * machine will refuse your request and will ask you to continue process or end.
 * When you will deposit money & will do any of the above processes, the program will
 * first check your balance then will do the process. If you will have insufficient balance,
 * it will refuse to perform your requested option. If you will have  enough balance to perform
 * the process, it will be performed.
 * I have made this ATM machine program which can be used to deposit money.
 * I can also be used for cash withdraw purposes.
 * After depositing money, balance is increased which can be checked.
 * I have included funds transfer option. After transfer of funds,
 * balance again changes.
 * 123456789 keypad can be used only for entering PIN code.
 * For other fields, kindly use keyboard.
 * After cash withdraw, your balance is again managed.
 * I have also included exit button to exit from program.
 * ---------------------
 * I certify that I worked on this assignment without any instructor's help.
 * I certify that each and every segment of code is written by me.
 * I certify that this is purely my own work.
 * I certify that anyone can use my code for study propose only.
 * I certify that I can explain each and every function, I used in this assignment.
 * I certify that I can perform this in front of anyone.
 */
public class DDPSP14BSE005G2A1 {


                public static DDPSP14BSE005G2A2 loading;

public static void main (String args[]){
     loading = new DDPSP14BSE005G2A2();
     loading.screenLoad();

}

}


CLASS DDPSP14BSE005G2A2
import java.awt.Color;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JWindow;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.Timer;
import java.awt.BorderLayout;

public class DDPSP14BSE005G2A2 extends JWindow {

                public JProgressBar loadBar;
                public int count = 0;
                public int max = 100;
                public Timer ti;
                public void screenLoad(){
                                JPanel screen = new JPanel();
                                screen.setLayout(new BorderLayout());
                                JLabel img = new JLabel(new ImageIcon(getClass().getResource("logo.gif")));
                                screen.add(img);
                                screen.setBackground(Color.WHITE);
                                loadBar = new JProgressBar();
                                loadBar.setMaximum(max);
                                loadBar.setForeground(Color.BLACK);
                                loadBar.setBorder(BorderFactory.createLineBorder(Color.BLACK));
                                screen.add(loadBar , BorderLayout.SOUTH);
                                this.setContentPane(screen);
                              this.pack();
                                screen.setSize(400, 400);
                                screen.setVisible(true);
                                setBounds(400,150,500,500);
                                setVisible(true);
                                progressBar();  
}
                private void progressBar(){
                                 ti = new Timer(10,new ActionListener(){
                                                public void actionPerformed(ActionEvent e){
                                                                loadBar.setValue(count);
                                                                if (max == count){
                                                                                DDPSP14BSE005G2A2.this.dispose();
                                                                                ti.stop();
                 DDPSP14BSE005G2A3 atm = new DDPSP14BSE005G2A3();
                 
                                                                }
                                                                count++;
                                                }
                                });
                                ti.start();
                }
}


CLASS DDPSP14BSE005G2A3
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JTextArea;
import javax.swing.JPasswordField;
import javax.swing.ImageIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.Font;
import java.awt.Color;
import javax.swing.Timer;
import java.net.URI;
import java.net.URL;
import java.awt.Desktop;

public class DDPSP14BSE005G2A3 extends JFrame {


                public JButton[] button = new JButton[13];
                public JButton[] sp = new JButton[5];
                public JButton fb;
                public JButton tw;
                public JButton withd = new JButton("WithDraw");
    public JButton itCard;
    public JButton itEn;
                public JButton pa = new JButton("PAY");
                public JButton cancel;
                public JButton URL;
                public JButton e_mail;
                public JButton dis;
                public JTextArea screen;
                public String passw = new String();
                public JTextArea _pass = new JTextArea();
                public JPanel j;
                public Timer t2;
                public JPasswordField pss = new JPasswordField();
    public Timer congo;
                public Timer sorry;
                public Timer end;
                public Timer restart;
                public JButton arrow[] = new JButton[7];
                public JTextArea billPayment = new JTextArea();
                public JTextArea cashWithdrawl = new JTextArea();
                public JTextArea balance = new JTextArea();
                public JTextArea deposit = new JTextArea();
                public JTextArea exit = new JTextArea();
                public JTextArea transfer = new JTextArea();
    public JTextArea _depo_box = new JTextArea();
    public JTextArea _fundstransfer = new JTextArea();
    public JTextArea _cnicText = new JTextArea();
    public JTextArea _ACtext = new JTextArea();
    public JTextArea _acName = new JTextArea();
    public JTextArea withdrawText = new JTextArea();
    public JTextArea Design = new JTextArea();
    public String withdraw;
    public double _withdraw;
    public double _balance = 0;
    public double _deposit = 0;
    public String depos_;
    public double depo_deposit = 0;
    public double _transfered = 0;
    public double _bill;
    public String getTransfer;
    public String accountNo;
    public String CNIC;
    public String AccountHolderName;
    public JButton transferButton;
    public String billCode;
    public String areaName;
    public String billAmount;
   


    public DDPSP14BSE005G2A3(){

               
                                super("Built & Designed by Arslan Malik");
       
        setUndecorated(true);
                                screen = new JTextArea();
                                screen.setBounds(2, 10, 800, 380);
                                screen.setEditable(false);
                    screen.setForeground(Color.WHITE);
                                screen.setBackground(Color.BLACK);
                                screen.setSelectedTextColor(Color.WHITE);
                                screen.setSelectionColor(Color.pink);
                                screen.setFont(new Font("Serif",Font.BOLD,40));
                                screen.setText("\n\n\n           WeLcOmE to AaReEz BAnKinGs");

                                    t2 = new Timer (5000,new ActionListener(){
                                                public void actionPerformed(ActionEvent e) {
                                                                screen.setFont(new Font("Times New Roman",Font.BOLD,15));
                                                                screen.setText("\n\n\n\n\n                                                                       WeLcOmE to AaReEz BAnKinGs");
                                                                screen.append("\n\n\n                                                                               Insert your DDPSP14BSE005G2A3 Card");
                                                                screen.append("\n                                                                                             &  \n                                                                                  Press INSERTED");          
                                                                screen.append("\n\n\n\n\n\n\nDeveloped by Arslan Malik");
                                                                screen.append("\nwww.CWorldbyAS.blogspot.com");
                                                                                                               
                                                }
                                });
                                t2.start();
                                t2.setRepeats(false);


                                screen.setFont(new Font("Serif",Font.BOLD,40));
        Design.setBounds(0, 0, 1300, 800);
        Design.setBackground(Color.YELLOW);
        Design.setEditable(false);

                                Passward pass = new Passward();
        Enter enter = new Enter();
        Keypad keypad = new Keypad();
        Exit exi = new Exit();
        BI bi = new BI();
        Deposit deposit = new Deposit();
        Funds transfer = new Funds();
        Cash cash = new Cash();
        Bill bill = new Bill();
        Done done = new Done();
        Reset reset = new Reset();
        TransferDone tdone = new TransferDone();
        EndTransaction finish = new EndTransaction();
        RestartTransaction restart = new RestartTransaction();
        CashWithDraw cdw = new CashWithDraw();
        Pay pay = new Pay();
        Cancel canc = new Cancel();
        Link link = new Link();
        Email email = new Email();
        Facebook face = new Facebook();
        Twitter twit = new Twitter();
                    j = new JPanel();
                                j.setLayout(null);
        
                                button[0] = new JButton("0");  
                                button[1] = new JButton("1");  
                                button[2] = new JButton("2");  
                                button[3] = new JButton("3");  
                                button[4] = new JButton("4");  
                                button[5] = new JButton("5");  
                                button[6] = new JButton("6");  
                                button[7] = new JButton("7");  
                                button[8] = new JButton("8");  
                                button[9] = new JButton("9");  
                                button[10]= new JButton("*");
                                button[11]= new JButton("#");

                                ImageIcon f = new ImageIcon("f.jpg");
                                ImageIcon t = new ImageIcon("t.png");
                                fb = new JButton("FB",f);
                                fb.setBounds(626, 400, 170, 100);
                                tw = new JButton("TW",t);
                                tw.setBounds(626, 502, 170, 100);
                               
                                ImageIcon de = new ImageIcon("en.jpg");
                                ImageIcon cd = new ImageIcon("cd.jpg");
        ImageIcon d = new ImageIcon("dis.jpg");
                                dis = new JButton("DIS",d);
                                dis.setBounds(803 , 601 , 480 ,122);
                                itCard = new JButton(cd);
                                itCard.setBounds(803, 0,480 ,300 );
                                itEn = new JButton(de);
                                itEn.setBounds(803, 300,480 ,300 );
                                ImageIcon em = new ImageIcon("Email.gif");
                                e_mail = new JButton("Send an E-MAIL to ARSLAN MALIK",em);
                                e_mail.setBounds(0, 607, 805, 120);      
                                ImageIcon insert = new ImageIcon("insert.png");
                                sp[0] = new JButton("INSERTED",insert);
                    ImageIcon ENTER = new ImageIcon("EButton.png");
                                sp[1] = new JButton("ENTER",ENTER);
                sp[1].setFont(new Font("Serif",Font.BOLD,15));
                    ImageIcon RESET = new ImageIcon("Reset.jpg");
                sp[2] = new JButton("RESET",RESET);
                                sp[2].setFont(new Font("Serif",Font.BOLD,15));
                                sp[3] = new JButton("YES");
                sp[3].setFont(new Font("Serif",Font.BOLD,15));
                                sp[4] = new JButton("NO");
                sp[4].setFont(new Font("Serif",Font.BOLD,15));
                sp[1].setEnabled(false);
                sp[2].setEnabled(false);
                ImageIcon c = new ImageIcon("canc.jpg");
                cancel = new JButton("CANCEL",c);
                cancel.setEnabled(false);
                                ImageIcon a = new ImageIcon("Arrow.png");
                                ImageIcon b = new ImageIcon("arrow-left.png");
                                arrow[0] = new JButton("Bill",a);
                                arrow[1] = new JButton("Cash",a);
                                arrow[2] = new JButton("Balance",a);
                                arrow[3] = new JButton("Deposit",b);
                                arrow[4] = new JButton("Transfer",b);
                                arrow[5] = new JButton("Exit",b);
                                arrow[6] = new JButton("DONE");
                    ImageIcon banner = new ImageIcon("banner.jpg");
                                transferButton = new JButton("TRANSFER");
                                URL = new JButton("URL",banner);
                               
                                URL.setBounds(0, 725, 1300 , 75);
                                button[0].setBounds(202, 556, 100, 50);
                                button[1].setBounds(100, 400, 100, 50);
                                button[2].setBounds(202, 400, 100, 50);
                                button[3].setBounds(304, 400, 100, 50);
                                button[4].setBounds(100, 452, 100, 50);
                                button[5].setBounds(202, 452, 100, 50);
                                button[6].setBounds(304, 452, 100, 50);
                                button[7].setBounds(100, 504, 100, 50);
                                button[8].setBounds(202, 504, 100, 50);
                                button[9].setBounds(304, 504, 100, 50);
                                button[10].setBounds(100, 556, 100, 50);
                                button[11].setBounds(304, 556, 100, 50);
       
                                sp[0].setBounds(420, 400, 100, 100);
        sp[1].setBounds(525, 400, 100, 100);
        sp[2].setBounds(420, 502, 100, 100);
        cancel.setBounds(525, 502, 100, 100);
        sp[3].setBounds(300, 340 , 150, 25);
        sp[4].setBounds(452, 342, 150, 25);
                                arrow[0].setBounds(2, 100, 95, 50);
        arrow[1].setBounds(2, 220 , 95, 50);
        arrow[2].setBounds(2, 340 , 95, 50);
        arrow[3].setBounds(702, 100, 95, 50);
        arrow[4].setBounds(702, 220, 95, 50);
        arrow[5].setBounds(702, 340, 95, 50);
        withd.setBounds(240, 242, 100, 30);
        j.add(cancel);
        j.add(button[0]);
        j.add(button[1]);
        j.add(button[2]);
        j.add(button[3]);
        j.add(button[4]);
        j.add(button[5]);
        j.add(button[6]);
        j.add(button[7]);
        j.add(button[8]);
        j.add(button[9]);
        j.add(button[10]);
        j.add(button[11]);
        j.add(sp[0]);
        j.add(sp[1]);
        j.add(sp[2]);
        j.add(e_mail);
        j.add(URL);
        j.add(screen);       
        j.add(Design);
        Design.add(itCard);
        Design.add(itEn);
        Design.add(dis);
        Design.add(fb);
        Design.add(tw);
        j.setVisible(true);
        add(j);
       
        setSize(1300, 800);
        setVisible(true);

                               

        sp[0].addActionListener(pass);
        sp[1].addActionListener(enter);
        sp[2].addActionListener(reset);
        sp[3].addActionListener(finish);
        sp[4].addActionListener(restart);
        button[0].addActionListener(keypad);
        button[1].addActionListener(keypad);
        button[2].addActionListener(keypad);
        button[3].addActionListener(keypad);
        button[4].addActionListener(keypad);
        button[5].addActionListener(keypad);
        button[6].addActionListener(keypad);
        button[7].addActionListener(keypad);
        button[8].addActionListener(keypad);
        button[9].addActionListener(keypad);
        arrow[0].addActionListener(bill);
        arrow[1].addActionListener(cash);
        arrow[2].addActionListener(bi);
        arrow[3].addActionListener(deposit);
        arrow[4].addActionListener(transfer);
        arrow[5].addActionListener(exi);
        arrow[6].addActionListener(done);
        transferButton.addActionListener(tdone);
        withd.addActionListener(cdw);
        pa.addActionListener(pay);
        cancel.addActionListener(canc);
        URL.addActionListener(link);
        e_mail.addActionListener(email);
        fb.addActionListener(face);
        tw.addActionListener(twit);

                                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


    }


   
private class Cancel implements ActionListener{
                public void actionPerformed(ActionEvent e){
                               
                                if (e.getActionCommand() == "CANCEL"){
                                               
                                    screen.remove(pa);
                                                screen.remove(sp[3]);
                                    screen.remove(sp[4]);
                                    end = new Timer(3000, new ActionListener(){
                                                public void actionPerformed(ActionEvent e){

                                                sp[1].setEnabled(false);
                                                sp[2].setEnabled(false);
                                                cancel.setEnabled(false);

                                                                screen.remove(billPayment);
                                                                                screen.remove(transferButton);
                                                                                screen.remove(cashWithdrawl);
                                                                                screen.remove(balance);
                                                                                screen.remove(deposit);
                                                                                screen.remove(transfer);
                                                                                screen.remove(exit);
                                                                    screen.remove(arrow[0]);
                                                        screen.remove(arrow[1]);
                                                        screen.remove(arrow[2]);
                                                        screen.remove(arrow[3]);
                                                        screen.remove(arrow[4]);
                                                        screen.remove(arrow[5]);
                                                                                screen.remove(transferButton);
                                                                                screen.remove(_cnicText);
                                                                                screen.remove(_ACtext);
                                                                                screen.remove(_acName);
                                            screen.remove(_fundstransfer);
                                            screen.remove(_pass);
                                            screen.remove(pss);
                                            screen.setText("");
                                                                                screen.setText("\n\n\n\n                    Take Your DDPSP14BSE005G2A3 Card \n                                    &\n                           THANK YOU..!!\n                           GOOD BYE..!!!\n                        Have A NicE DaY");

                                                }
                                    });
                                    end.start();
                                    end.setRepeats(false);
                                                t2.start();
                                    t2.setRepeats(false);


                                }
                }
}
private class Passward implements ActionListener{
               
                public void actionPerformed(ActionEvent e ){
               
                                if (e.getActionCommand() == "INSERTED"){
                                               
                                sp[1].setEnabled(true);
                                sp[2].setEnabled(true);
                                cancel.setEnabled(true);

                                                _pass.setBounds( 350 ,200 , 100 , 40);
                                                _pass.setVisible(true);
                                                _pass.setEditable(false);
                                                _pass.setBackground(Color.cyan);
                                                screen.add(_pass);
                                                screen.setFont(new Font("Serif",Font.BOLD,30));
                                                screen.setText("\n\n\n\n                                          Enter PIN");
                               

                                    t2.stop();
                                   
                                  
                                }

                                pss.setBounds(0,0,100,40);
                                pss.setVisible(true);
                                pss.setEditable(true);                   
                                _pass.add(pss);


                                }
}
private class BI implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand()=="Balance"){
                                                screen.setText("");
                                    screen.remove(arrow[0]);
                        screen.remove(arrow[1]);
                        screen.remove(arrow[2]);
                        screen.remove(arrow[3]);
                        screen.remove(arrow[4]);
                        screen.remove(arrow[5]);
                        screen.remove(arrow[6]);

                                                screen.remove(billPayment);
                                                screen.remove(cashWithdrawl);
                                                screen.remove(balance);
                                                screen.remove(deposit);
                                                screen.remove(transfer);
                                                screen.remove(exit);
                                                screen.setText("\n\n\n\n                   Your Balance is Rs. "+_balance);
            screen.append("\n\n               Do you want to make another transaction?");
            screen.add(sp[3]);
            screen.add(sp[4]);

                                }
                }
}
private class Deposit implements ActionListener{
                public void actionPerformed(ActionEvent e){

                                if (e.getActionCommand()=="Deposit"){
                                                screen.setText("");
                                                screen.remove(billPayment);
                                                screen.remove(cashWithdrawl);
                                                screen.remove(balance);
                                                screen.remove(deposit);
                                                screen.remove(transfer);
                                    screen.remove(arrow[0]);
                        screen.remove(arrow[1]);
                        screen.remove(arrow[2]);
                        screen.remove(arrow[3]);
                        screen.remove(arrow[4]);
                        screen.remove(arrow[5]);
                                               
                                                screen.setText("                            A a R e R z B a N k I n G s");
                                                screen.append("\n                                    Deposit Funds");
                                                _depo_box.setBackground(Color.YELLOW);
                                                _depo_box.setFont(new Font("Times New Roman",Font.BOLD,30));
                                                _depo_box.setBounds(240,200,300,40);                              
                                                screen.add(_depo_box);
          
                                                arrow[6].setBounds(330,250,100,50);
                                                screen.add(arrow[6]);                  
           
            
                                }
                }
}

private class Done implements ActionListener{
                public void actionPerformed(ActionEvent e ){
                                if (e.getActionCommand() == "DONE"){
            screen.setText("");
                                                depos_ =_depo_box.getText();
                                                depo_deposit = Double.parseDouble( depos_);
                                                _deposit = depo_deposit + _balance;                                   
                                                _balance = _deposit;
                                                screen.remove(exit);
                                                if(_balance == _deposit){
                                                    screen.remove(arrow[0]);
                                        screen.remove(arrow[1]);
                                        screen.remove(arrow[2]);
                                        screen.remove(arrow[3]);
                                        screen.remove(arrow[4]);
                                        screen.remove(arrow[5]);
                                        screen.remove(arrow[6]);

                                                                screen.remove(arrow[6]);
                                                                screen.remove(_depo_box);
                                                                screen.setText("\n\n\n                    You have successfully deposited\n                                   Rs. "+depo_deposit+"\n                    Your New Balance is Rs. "+_balance);
                            screen.append("\n               Do you want to make another transaction?");
                            screen.add(sp[3]);
                            screen.add(sp[4]);

                                                }
                                               
                                }
                }
}

private class Funds implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "Transfer"){
                                                screen.setText("");
                                    screen.remove(arrow[0]);
                        screen.remove(arrow[1]);
                        screen.remove(arrow[2]);
                        screen.remove(arrow[3]);
                        screen.remove(arrow[4]);
                        screen.remove(arrow[5]);
                        screen.remove(arrow[6]);

                                                screen.remove(billPayment);
                                                screen.remove(cashWithdrawl);
                                                screen.remove(balance);
                                                screen.remove(deposit);
                                                screen.remove(transfer);
                                                screen.remove(exit);
                                                transferButton.setBounds(400, 250, 150, 50);
                                    _cnicText.setBackground(Color.YELLOW);
                                    _cnicText.setForeground(Color.BLACK);
                                                _cnicText.setFont(new Font("Times New Roman",Font.BOLD,20));
                                    _cnicText.setBounds(200, 160, 150, 25);
                                    _ACtext.setBackground(Color.YELLOW);
                                    _ACtext.setForeground(Color.BLACK);
                                                _ACtext.setFont(new Font("Times New Roman",Font.BOLD,20));
                                    _ACtext.setBounds(200, 130, 150, 25);
                                    _acName.setBackground(Color.YELLOW);
                                    _acName.setForeground(Color.BLACK);
                                                _acName.setFont(new Font("Times New Roman",Font.BOLD,20));
                                    _acName.setBounds(200, 100, 150, 25);
                                                screen.add(transferButton);
                                                screen.add(_cnicText);
                                                screen.add(_ACtext);
                                                screen.add(_acName);

                                                _fundstransfer.setFont(new Font("Times New Roman",Font.BOLD,20));
                                                _fundstransfer.setBounds(200, 190, 150, 25);
                                                _fundstransfer.setBackground(Color.YELLOW);
            screen.add(_fundstransfer);
                                                screen.setFont(new Font("Times New Roman",Font.BOLD,15));
            screen.setText("\n                Enter the following information :");
                                    screen.append("\n\n\n\n                          A/C Name");
                                screen.append("\n\n                          A/C No.");
                                    screen.append("\n\n                          CNIC of A/C");
                                    screen.append("\n\n                          Amount");
           
                                }
                }
}

private class TransferDone implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "TRANSFER"){
                                                if (_balance > 0 ){
                                    AccountHolderName = _acName.getText();
                                    CNIC = _cnicText.getText();
                                    accountNo = _ACtext.getText();
                                                getTransfer = _fundstransfer.getText();
                                    _transfered = Double.parseDouble(getTransfer);
                                                screen.setFont(new Font("Serif",Font.BOLD,30));                           
                                                screen.remove(_fundstransfer);
                                                screen.remove(transferButton);
                                                screen.remove(_cnicText);
                                                screen.remove(_acName);
                                                screen.remove(_ACtext);
                                                if(_transfered <= _balance) {
                                                    screen.remove(arrow[0]);
                                        screen.remove(arrow[1]);
                                        screen.remove(arrow[2]);
                                        screen.remove(arrow[3]);
                                        screen.remove(arrow[4]);
                                        screen.remove(arrow[5]);
                                        screen.remove(arrow[6]);

                                                                screen.setText("");
                                                screen.setText("\n\n               You have successfully transfered Rs. "+_transfered+"\n               to Mr."+AccountHolderName+"\n               in A/C "+accountNo+"\n               CNIC : "+CNIC);
                screen.append("\n\n               Do you want to make another transaction?");
                screen.add(sp[3]);
                screen.add(sp[4]);
                _balance = _balance - _transfered;
                                }
                                                else {
                                                    screen.remove(arrow[0]);
                                        screen.remove(arrow[1]);
                                        screen.remove(arrow[2]);
                                        screen.remove(arrow[3]);
                                        screen.remove(arrow[4]);
                                        screen.remove(arrow[5]);
                                        screen.remove(arrow[6]);

                                                                screen.setText("\n\n               You don't have sufficient Balance.\n               Your Balance is "+_balance);
                            screen.append("\n\n               Do you want to make another transaction?");
                            screen.add(sp[3]);
                            screen.add(sp[4]);

                                                }
                                                }}
                }
}
private class Exit implements ActionListener{
                public void actionPerformed(ActionEvent e){
                               
                                if(e.getActionCommand()== "Exit"){
                                 System.exit(0);               
                                }
                }
}
private class CashWithDraw implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "WithDraw"){
            screen.remove(withd);
                                                withdraw = withdrawText.getText();
            _withdraw = Double.parseDouble(withdraw);

                                                if (_balance > 0 && _withdraw <= _balance){
               
                _balance = _balance - _withdraw;
                screen.remove(withdrawText);
                                    screen.remove(arrow[0]);
                        screen.remove(arrow[1]);
                        screen.remove(arrow[2]);
                        screen.remove(arrow[3]);
                        screen.remove(arrow[4]);
                        screen.remove(arrow[5]);
                        screen.remove(arrow[6]);

                screen.setFont(new Font("Times New Roman",Font.BOLD,30));
                screen.setText("                            A a R e R z B a N k I n G s");
                screen.append("\n\n                   You have successfully withdrawn Rs. "+_withdraw+"\n                   Your Remaining Balance is Rs. "+_balance);
                            screen.append("\n\n               Do you want to make another transaction?");
                            screen.add(sp[3]);
                            screen.add(sp[4]);


            }
            else {
                                    screen.remove(arrow[0]);
                        screen.remove(arrow[1]);
                        screen.remove(arrow[2]);
                        screen.remove(arrow[3]);
                        screen.remove(arrow[4]);
                        screen.remove(arrow[5]);
                        screen.remove(arrow[6]);

                screen.setText("                            A a R e R z B a N k I n G s");
                screen.append("\n\n                   You don't have sufficient balance.");
                            screen.append("\n\n               Do you want to make another transaction?");
                            screen.add(sp[3]);
                            screen.add(sp[4]);
                                                                screen.setFont(new Font("Times New Roman",Font.BOLD,30));
                screen.remove(withdrawText);


               
            }


                                }
                }
}
private class Cash implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "Cash"){
                                                screen.setText("");
                                    screen.remove(arrow[0]);
                        screen.remove(arrow[1]);
                        screen.remove(arrow[2]);
                        screen.remove(arrow[3]);
                        screen.remove(arrow[4]);
                        screen.remove(arrow[5]);
                        screen.remove(arrow[6]);

                                                screen.remove(billPayment);
                                                screen.remove(transferButton);
                                                screen.remove(cashWithdrawl);
                                                screen.remove(balance);
                                                screen.remove(deposit);
                                                screen.remove(transfer);
                                                screen.remove(exit);
                                                screen.remove(transferButton);
                                                screen.remove(_cnicText);
                                                screen.remove(_ACtext);
                                                screen.remove(_acName);
            screen.remove(_fundstransfer);
            screen.remove(_pass);
            screen.remove(pss);
            screen.remove(_depo_box);
                                                screen.setText("                            A a R e R z B a N k I n G s");
            screen.append("\n\n\n                       Enter the amount you want to withdraw : ");
            withdrawText.setBounds(240,200,300,40);
            withdrawText.setBackground(Color.GREEN);
            withdrawText.setForeground(Color.BLACK);
                                                withdrawText.setFont(new Font("Times New Roman",Font.BOLD,20));
            screen.add(withdrawText);
            screen.add(withd);
                                }
                }
}
private class Bill implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "Bill"){
                                                screen.remove(billPayment);
                                                screen.remove(transferButton);
                                                screen.remove(cashWithdrawl);
                                                screen.remove(balance);
                                                screen.remove(deposit);
                                                screen.remove(transfer);
                                                screen.remove(exit);
                        screen.remove(transferButton);
            screen.remove(_pass);
            screen.remove(pss);
            screen.remove(_depo_box);
            screen.remove(sp[3]);
            screen.remove(sp[4]);
           
                                                pa.setBounds(400, 250, 150, 50);
                                    _cnicText.setBackground(Color.YELLOW);
                                    _cnicText.setForeground(Color.BLACK);
                                                _cnicText.setFont(new Font("Times New Roman",Font.BOLD,20));
                                    _cnicText.setBounds(200, 160, 150, 25);
                                    _cnicText.setText("");
                                    _ACtext.setBackground(Color.YELLOW);
                                    _ACtext.setForeground(Color.BLACK);
                                                _ACtext.setFont(new Font("Times New Roman",Font.BOLD,20));
                                    _ACtext.setBounds(200, 130, 150, 25);
                                    _ACtext.setText("");
                                    _acName.setBackground(Color.YELLOW);
                                    _acName.setForeground(Color.BLACK);
                                                _acName.setFont(new Font("Times New Roman",Font.BOLD,20));
                                    _acName.setBounds(200, 100, 150, 25);
                                                _acName.setText("");
                                    screen.add(pa);
                                                screen.add(_cnicText);
                                                screen.add(_ACtext);
                                                screen.add(_acName);

                                                _fundstransfer.setFont(new Font("Times New Roman",Font.BOLD,20));
                                                _fundstransfer.setBounds(200, 190, 150, 25);
                                                _fundstransfer.setBackground(Color.YELLOW);
            _fundstransfer.setText("");
                                                screen.add(_fundstransfer);
                                                screen.setFont(new Font("Times New Roman",Font.BOLD,15));
            screen.setText("\n                Enter the following information :");
                                    screen.append("\n\n\n\n                          AREA Name");
                                screen.append("\n\n                          Bill CODE");
                                    screen.append("\n\n                          CNIC of Customer");
                                    screen.append("\n\n                          Amount");
                                    screen.remove(arrow[0]);
                        screen.remove(arrow[1]);
                        screen.remove(arrow[2]);
                        screen.remove(arrow[3]);
                        screen.remove(arrow[4]);
                        screen.remove(arrow[5]);
                        screen.remove(arrow[6]);

           

                                }
                }
}
private class Pay implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "PAY"){
                                                areaName = _acName.getText();
                                                billCode = _ACtext.getText();
                                                CNIC = _cnicText.getText();
                                                billAmount = _fundstransfer.getText();
                                                _bill = Double.parseDouble(billAmount);
                                                if (_bill <= _balance){
                                               
                                                                _balance = _balance - _bill;
                                                    screen.remove(arrow[0]);
                                        screen.remove(arrow[1]);
                                        screen.remove(arrow[2]);
                                        screen.remove(arrow[3]);
                                        screen.remove(arrow[4]);
                                        screen.remove(arrow[5]);
                                        screen.remove(arrow[6]);
                screen.remove(pa);
                                                                screen.remove(_cnicText);
                                                                screen.remove(_ACtext);
                                                                screen.remove(_acName);
                            screen.remove(_fundstransfer);
                screen.setText("                            A a R e R z B a N k I n G s");
                            screen.append("\n\n\n                       You have paid Rs. "+_bill+"\n                       Your remaining Balance is Rs. "+_balance);
                            screen.add(sp[3]);
                            screen.add(sp[4]);
                            screen.append("\n\n               Do you want to make another transaction?");
                            screen.setFont(new Font("Times New Roman",Font.BOLD,30));
               
                                                               
                                                               
                                                }
                                                else {
                            screen.setFont(new Font("Times New Roman",Font.BOLD,30));
                                                    screen.remove(arrow[0]);
                                        screen.remove(arrow[1]);
                                        screen.remove(arrow[2]);
                                        screen.remove(arrow[3]);
                                        screen.remove(arrow[4]);
                                        screen.remove(arrow[5]);
                                        screen.remove(arrow[6]);

                            screen.remove(pa);
                            screen.setText("                            A a R e R z B a N k I n G s");
                            screen.add(sp[3]);
                            screen.add(sp[4]);
                screen.append("\n\n                   You don't have sufficient balance.");
                            screen.append("\n\n               Do you want to make another transaction?");
                                                                screen.remove(_cnicText);
                                                                screen.remove(_ACtext);
                                                                screen.remove(_acName);
                            screen.remove(_fundstransfer);

                                                }
                                }
                }
}
private class Enter implements ActionListener{

                public void actionPerformed(ActionEvent e){

                                   
                                if (e.getActionCommand()=="ENTER"){
                    _pass.setText("");
                                                screen.remove(_pass);
                                                if(passw.contains("1234")){
                                                                screen.setText("\n\n\n\n                                Congratulations...!!!\n                     Your PIN CODE is ACCEPTED");
                                                    screen.add(arrow[0]);
                                        screen.add(arrow[1]);
                                        screen.add(arrow[2]);
                                        screen.add(arrow[3]);
                                        screen.add(arrow[4]);
                                        screen.add(arrow[5]);
                                                                congo = new Timer(3000,new ActionListener(){
                                                                public void actionPerformed(ActionEvent e){
                                                                                screen.setText("                             A a R e R z B a N k I n G s");
                                                                                billPayment.append("> Bill Payment");
                                                                                billPayment.setBounds(100,100,250,40);
                                                                                billPayment.setBackground(Color.BLACK);
                                                                                billPayment.setForeground(Color.WHITE);
                                                                                billPayment.setEditable(false);
                                                                                billPayment.setFont(new Font("Times New Roman",Font.BOLD,30));
                                                                                screen.add(billPayment);
                                                                                cashWithdrawl.append("> Cash Withdrawl");
                                                                                cashWithdrawl.setBounds(100,220,250,40);
                                                                                cashWithdrawl.setBackground(Color.BLACK);
                                                                                cashWithdrawl.setForeground(Color.WHITE);
                                                                                cashWithdrawl.setEditable(false);
                                                                                cashWithdrawl.setFont(new Font("Times New Roman",Font.BOLD,30));
                                                                                screen.add(cashWithdrawl);
                                                                                balance.append("> Balance Inquiry");
                                                                                balance.setBounds(100, 340, 250, 40);
                                                                                balance.setBackground(Color.BLACK);
                                                                                balance.setForeground(Color.WHITE);
                                                                                balance.setEditable(false);
                                                                                balance.setFont(new Font("Times New Roman",Font.BOLD,30));
                                                                                screen.add(balance);
                                                                                deposit.append("> Deposit Funds");
                                                                                deposit.setBounds(400, 100, 250, 40);
                                                                                deposit.setBackground(Color.BLACK);
                                                                                deposit.setForeground(Color.WHITE);
                                                                                deposit.setEditable(false);
                                                                                deposit.setFont(new Font("Times New Roman",Font.BOLD,30));
                                                                                screen.add(deposit);
                                                                                exit.append("> Exit");
                                                                                exit.setBounds(400, 340, 250, 40);
                                                                                exit.setBackground(Color.BLACK);
                                                                                exit.setForeground(Color.WHITE);
                                                                                exit.setEditable(false);
                                                                                exit.setFont(new Font("Times New Roman",Font.BOLD,30));
                                                                                screen.add(exit);
                                                                                transfer.append("> Transfer Funds");
                                                                                transfer.setBounds(400,220,250,40);
                                                                                transfer.setBackground(Color.BLACK);
                                                                                transfer.setForeground(Color.WHITE);
                                                                                transfer.setFont(new Font("Times New Roman",Font.BOLD,30));
                                                                                transfer.setEditable(false);
                                                                                screen.add(transfer);

                                                                }

                                                });   
                                                 congo.start();                                  
                                                 congo.setRepeats(false);

               
               
                                                }
                                                else
                                                {
                                                                screen.setText("\n\n\n\n               Sorry Wrong PIN CODE...!!!");
                                                                 sorry = new Timer(3000,new ActionListener(){
                                                                                public void actionPerformed(ActionEvent e){
                                                                                                screen.setText("\n\n\n\n                    Take Your DDPSP14BSE005G2A3 Card \n                                    &\n                           TRY AGAIN");
                                                                               
                                                                                    screen.remove(arrow[0]);
                                                                        screen.remove(arrow[1]);
                                                                        screen.remove(arrow[2]);
                                                                        screen.remove(arrow[3]);
                                                                        screen.remove(arrow[4]);
                                                                        screen.remove(arrow[5]);
                                                                        screen.remove(arrow[6]);
                                                                                               
                                                                                }
                                                                });
                                                                sorry.start();
                                                                sorry.setRepeats(false);
                t2.start();
                t2.setRepeats(false);
                                                               
                                                               
                                                               
                                }
               
                                }

                }             

}

private class Keypad implements ActionListener {
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand()=="0" ||e.getActionCommand()=="1" ||e.getActionCommand()=="2" ||e.getActionCommand()=="3" ||e.getActionCommand()=="4" ||e.getActionCommand()=="5" ||e.getActionCommand()=="6" ||e.getActionCommand()=="7" ||e.getActionCommand()=="8" ||e.getActionCommand()=="9" )
        
                                                {
                                                   _pass.setFont(new Font("Serif",Font.BOLD,35));
                                                   _pass.append(e.getActionCommand());
               passw = _pass.getText();             
                                                }
                                pss.setText(passw);
                                screen.setText("");
                               
                }



}
private class EndTransaction implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "YES"){
                                    screen.add(arrow[0]);
                        screen.add(arrow[1]);
                        screen.add(arrow[2]);
                        screen.add(arrow[3]);
                        screen.add(arrow[4]);
                        screen.add(arrow[5]);

                                                screen.remove(pa);
                                                screen.remove(sp[3]);
                                                screen.remove(sp[4]);
                                                congo.start();
                                                congo.setRepeats(false);

                               
                }
                }
}
private class RestartTransaction implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "NO"){
                                    screen.remove(pa);
                                                screen.remove(sp[3]);
                                    screen.remove(sp[4]);
                                    end = new Timer(3000, new ActionListener(){
                                                public void actionPerformed(ActionEvent e){

                                                sp[1].setEnabled(false);
                                                sp[2].setEnabled(false);
                                                cancel.setEnabled(false);

                                                                screen.remove(billPayment);
                                                                                screen.remove(transferButton);
                                                                                screen.remove(cashWithdrawl);
                                                                                screen.remove(balance);
                                                                                screen.remove(deposit);
                                                                                screen.remove(transfer);
                                                                                screen.remove(exit);
                                                                    screen.remove(arrow[0]);
                                                        screen.remove(arrow[1]);
                                                        screen.remove(arrow[2]);
                                                        screen.remove(arrow[3]);
                                                        screen.remove(arrow[4]);
                                                        screen.remove(arrow[5]);
                                                                                screen.remove(transferButton);
                                                                                screen.remove(_cnicText);
                                                                                screen.remove(_ACtext);
                                                                                screen.remove(_acName);
                                            screen.remove(_fundstransfer);
                                            screen.remove(_pass);
                                            screen.remove(pss);
                                            screen.setText("");
                                                                                screen.setText("\n\n\n\n                    Take Your DDPSP14BSE005G2A3 Card \n                                    &\n                           THANK YOU..!!\n                           GOOD BYE..!!!\n                        Have A NicE DaY");

                                                }
                                    });
                                    end.start();
                                    end.setRepeats(false);
                                                t2.start();
                                    t2.setRepeats(false);

                }
                }
}
private class Reset implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "RESET"){
                                                screen.setText("");
                                                screen.remove(pa);
                                    screen.remove(arrow[0]);
                        screen.remove(arrow[1]);
                        screen.remove(arrow[2]);
                        screen.remove(arrow[3]);
                        screen.remove(arrow[4]);
                        screen.remove(arrow[5]);
                        screen.remove(arrow[6]);
                                                screen.remove(billPayment);
                                                screen.remove(transferButton);
                                                screen.remove(cashWithdrawl);
                                                screen.remove(balance);
                                                screen.remove(deposit);
                                                screen.remove(transfer);
                                                screen.remove(exit);
                        screen.remove(transferButton);
                                                screen.remove(_cnicText);
                                                screen.remove(_ACtext);
                                                screen.remove(_acName);
            screen.remove(_fundstransfer);
            screen.remove(_pass);
            screen.remove(pss);
            screen.remove(_depo_box);
            screen.remove(sp[3]);
            screen.remove(sp[4]);
     

                                                screen.setFont(new Font("Serif",Font.BOLD,40));
                                                screen.setText("\n\n\n           WeLcOmE to AaReEz BAnKinGs");

                                                    t2 = new Timer (5000,new ActionListener(){
                                                                public void actionPerformed(ActionEvent e) {
                                                                                screen.setFont(new Font("Times New Roman",Font.BOLD,15));
                                                                                screen.setText("\n\n\n\n\n                                                                       WeLcOmE to AaReEz BAnKinGs");
                                                                                screen.append("\n\n\n                                                                               Insert your DDPSP14BSE005G2A3 Card");
                                                                                screen.append("\n                                                                                             &  \n                                                                                  Press INSERTED");          
                                                                                screen.append("\n\n\n\n\n\n\nDeveloped by Arslan Malik");
                                                                                screen.append("\nwww.CWorldbyAS.blogspot.com");
                                                                                                                               
                                                                }
                                                });
                                                t2.start();
                                                t2.setRepeats(false);
                                }

}
}
private class Link implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "URL"){
                                try{
                                                Desktop.getDesktop().browse(new URL("http://www.CWorldbyAS.blogspot.com").toURI());
                                }
                                catch(Exception exception) {
                                                exception.printStackTrace();
                                }
                                }
                }
}
private class Email implements ActionListener{
                public void actionPerformed(ActionEvent e){
                       if (e.getActionCommand() == "Send an E-MAIL to ARSLAN MALIK"){
                                  try{
                                                 URI uri = new URI("mailto::itsaareez1@yahoo.com");
                                   Desktop.getDesktop().mail(uri);
                                  }
                                  catch (Exception exception){
                                                  exception.printStackTrace();
                                  }
                                  }
                }
}
private class Facebook implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "FB"){
                                try{
                                                Desktop.getDesktop().browse(new URL("http://www.facebook.com/arslan.ud.din").toURI());
                                }
                                catch(Exception exception) {
                                                exception.printStackTrace();
                                }
                                }
                }
}
private class Twitter implements ActionListener{
                public void actionPerformed(ActionEvent e){
                                if (e.getActionCommand() == "TW"){
                                try{
                                                Desktop.getDesktop().browse(new URL("http://www.twitter.com/itsaareez").toURI());
                                }
                                catch(Exception exception) {
                                                exception.printStackTrace();
                                }
                                }
                }
}
}

1 comment: