package purseclient;

import javax.swing.*;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.Font;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
import java.awt.*;
import java.util.Arrays;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class PurseNew extends JFrame {
    private static PurseCommunication PC;

    javax.swing.JPanel PINValidationPanel = new JPanel();
    javax.swing.JPanel TransactionsPanel = new JPanel();
    javax.swing.JPasswordField PassField = new JPasswordField();
    javax.swing.JButton GoValidate = new JButton();
    javax.swing.JLabel InsertPIN = new JLabel();
    javax.swing.JMenuBar MainMenu = new JMenuBar();
    javax.swing.JMenu Connection = new JMenu();
    javax.swing.JMenuItem Disconnect = new JMenuItem();
    javax.swing.JMenu File = new JMenu();
    javax.swing.JMenuItem Exit = new JMenuItem();
    javax.swing.JMenuItem Connect = new JMenuItem();
    javax.swing.JLabel ResultLabel = new JLabel();
    javax.swing.JMenu Processes = new JMenu();
    javax.swing.JMenuItem Transactions = new JMenuItem();
    javax.swing.JMenuItem Account = new JMenuItem();
    javax.swing.JTextField CreditBox = new JTextField();
    javax.swing.JTextField DebitBox = new JTextField();
    javax.swing.JButton GoCredit = new JButton();
    javax.swing.JButton GoDebit = new JButton();
    javax.swing.JTextField BallanceBox = new JTextField();
    javax.swing.JPanel AccountPanel = new JPanel();
    javax.swing.JTextField CurrentAccNo = new JTextField();
    javax.swing.JTextField NewAccNo = new JTextField();
    javax.swing.JTextPane jTextPane1 = new JTextPane();
    javax.swing.JTextPane jTextPane2 = new JTextPane();
    javax.swing.JMenuItem LogIn = new JMenuItem();
    javax.swing.JButton SetAccNo = new JButton();
    javax.swing.JTextPane jTextPane3 = new JTextPane();
    javax.swing.JLabel AccResults = new JLabel();
    javax.swing.JPanel UserPanel = new JPanel();
    javax.swing.JMenuItem User = new JMenuItem();
    javax.swing.JLabel ImageLabel = new JLabel();
    javax.swing.JLabel jLabel1 = new JLabel();
    javax.swing.JLabel jLabel2 = new JLabel();
    javax.swing.JLabel jLabel3 = new JLabel();
    javax.swing.JLabel jLabel4 = new JLabel();
    javax.swing.JLabel SurnameLabel = new JLabel();
    javax.swing.JLabel NameLabel = new JLabel();
    javax.swing.JLabel AddressLabel = new JLabel();
    javax.swing.JPanel ChangeInfosPanel = new JPanel();
    javax.swing.JMenuItem Change = new JMenuItem();
    javax.swing.JTextField PhotoField = new JTextField();
    javax.swing.JLabel jLabel5 = new JLabel();
    javax.swing.JLabel jLabel6 = new JLabel();
    javax.swing.JLabel jLabel7 = new JLabel();
    javax.swing.JLabel jLabel8 = new JLabel();
    javax.swing.JTextField NameField = new JTextField();
    javax.swing.JTextField SurnameField = new JTextField();
    javax.swing.JTextField AddressField = new JTextField();
    javax.swing.JButton Set = new JButton();
    javax.swing.JButton Browse = new JButton();
    javax.swing.JLabel jLabel9 = new JLabel();
    javax.swing.JPanel ChangePINPanel = new JPanel();
    javax.swing.JTextPane jTextPane4 = new JTextPane();
    javax.swing.JMenu Management = new JMenu();
    javax.swing.JMenuItem PINChange = new JMenuItem();
    JLabel AccNoLabel = new JLabel();
    JLabel jLabel10 = new JLabel();
    JLabel jLabel11 = new JLabel();
    JLabel jLabel12 = new JLabel();
    JPasswordField oldPINField = new JPasswordField();
    JPasswordField newPINField1 = new JPasswordField();
    JPasswordField newPINField2 = new JPasswordField();
    JButton GoChangePIN = new JButton();
    public PurseNew() {
        try {
            jbInit();
            ClassLoader loadImg = getClass().getClassLoader();
            Image im = Toolkit.getDefaultToolkit().getImage(loadImg.getResource(
                    "purseclient/6-pin.gif"));
            setIconImage(im);
            PC = new PurseCommunication();
            this.getContentPane().add(PINValidationPanel);
            this.getContentPane().validate();
            this.getContentPane().repaint();

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public static void main(String[] args) {
        PurseNew pursewnd = new PurseNew();
    }

    private void jbInit() throws Exception {
        PINValidationPanel.setLayout(null);
        TransactionsPanel.setLayout(null);
        PassField.setText("");
        PassField.setBounds(new Rectangle(156, 117, 88, 24));
        GoValidate.setBounds(new Rectangle(263, 117, 71, 23));
        GoValidate.setText("Go");
        GoValidate.addActionListener(new PurseNew_GoValidate_actionAdapter(this));
        InsertPIN.setText("Insert PIN");
        InsertPIN.setBounds(new Rectangle(82, 123, 65, 18));
        this.setJMenuBar(MainMenu);
        this.setResizable(false);
        this.addWindowListener(new PurseNew_this_windowAdapter(this));
        Connection.setText("Connection");
        Disconnect.setEnabled(false);
        Disconnect.setText("Disconnect");
        Disconnect.addActionListener(new PurseNew_Disconnect_actionAdapter(this));
        File.setText("File");
        Exit.setText("Exit");
        Exit.addActionListener(new PurseNew_Exit_actionAdapter(this));
        ResultLabel.setFont(new java.awt.Font("Dialog", Font.BOLD, 15));
        ResultLabel.setHorizontalAlignment(SwingConstants.CENTER);
        ResultLabel.setBounds(new Rectangle(85, 180, 231, 29));
        Processes.setText("Processes");
        Transactions.setToolTipText("");
        Transactions.setActionCommand("Transactions");
        Transactions.setText("Transactions");
        Transactions.addActionListener(new PurseNew_Transactions_actionAdapter(this));
        Account.setText("Account Number");
        Account.addActionListener(new PurseNew_Account_actionAdapter(this));
        CreditBox.setText("");
        CreditBox.setHorizontalAlignment(SwingConstants.CENTER);
        CreditBox.setBounds(new Rectangle(214, 83, 84, 20));
        DebitBox.setText("");
        DebitBox.setHorizontalAlignment(SwingConstants.CENTER);
        DebitBox.setBounds(new Rectangle(214, 128, 84, 20));
        GoCredit.setBounds(new Rectangle(68, 80, 84, 23));
        GoCredit.setText("Credit");
        GoCredit.addActionListener(new PurseNew_GoCredit_actionAdapter(this));
        GoDebit.setBounds(new Rectangle(68, 125, 84, 23));
        GoDebit.setText("Debit");
        GoDebit.addActionListener(new PurseNew_GoDebit_actionAdapter(this));
        BallanceBox.setEnabled(true);
        BallanceBox.setEditable(false);
        BallanceBox.setText("");
        BallanceBox.setHorizontalAlignment(SwingConstants.CENTER);
        BallanceBox.setBounds(new Rectangle(214, 174, 84, 20));
        AccountPanel.setLayout(null);
        CurrentAccNo.setEnabled(false);
        CurrentAccNo.setText("");
        CurrentAccNo.setHorizontalAlignment(SwingConstants.CENTER);
        CurrentAccNo.setBounds(new Rectangle(222, 108, 85, 20));
        NewAccNo.setText("");
        NewAccNo.setHorizontalAlignment(SwingConstants.CENTER);
        NewAccNo.setBounds(new Rectangle(222, 144, 85, 20));
        jTextPane1.setEnabled(false);
        jTextPane1.setFont(new java.awt.Font("Dialog", Font.BOLD, 22));
        jTextPane1.setEditable(false);
        jTextPane1.setText("Transactions");
        jTextPane1.setBounds(new Rectangle(115, 19, 142, 41));
        jTextPane2.setEnabled(false);
        jTextPane2.setFont(new java.awt.Font("Dialog", Font.BOLD, 22));
        jTextPane2.setEditable(false);
        jTextPane2.setText("PIN Verification");
        jTextPane2.setBounds(new Rectangle(119, 20, 163, 39));
        LogIn.setText("Log in");
        LogIn.addActionListener(new PurseNew_LogIn_actionAdapter(this));
        SetAccNo.setBounds(new Rectangle(51, 141, 131, 23));
        SetAccNo.setText("Set New Number");
        SetAccNo.addActionListener(new PurseNew_SetAccNo_actionAdapter(this));
        jTextPane3.setFont(new java.awt.Font("Dialog", Font.BOLD, 22));
        jTextPane3.setText("Account Info");
        jTextPane3.setBounds(new Rectangle(118, 19, 137, 40));
        AccResults.setFont(new java.awt.Font("Dialog", Font.BOLD, 15));
        AccResults.setHorizontalAlignment(SwingConstants.CENTER);
        AccResults.setText("");
        AccResults.setVerticalAlignment(SwingConstants.TOP);
        AccResults.setBounds(new Rectangle(37, 179, 299, 30));
        Connect.setText("Connect");
        Connect.addActionListener(new PurseNew_Connect_actionAdapter(this));
        UserPanel.setLayout(null);
        User.setText("User Infos");
        User.addActionListener(new PurseNew_User_actionAdapter(this));
        ImageLabel.setHorizontalAlignment(SwingConstants.CENTER);
        ImageLabel.setText("No Photo");
        ImageLabel.setBounds(new Rectangle(22, 43, 130, 162));
        jLabel1.setFont(new java.awt.Font("Dialog", Font.BOLD, 14));
        jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
        jLabel1.setText("Client Info");
        jLabel1.setBounds(new Rectangle(190, 38, 122, 25));
        jLabel2.setText("Surname");
        jLabel2.setBounds(new Rectangle(188, 98, 54, 15));
        jLabel3.setText("Name");
        jLabel3.setBounds(new Rectangle(188, 124, 48, 19));
        jLabel4.setText("Address");
        jLabel4.setBounds(new Rectangle(188, 159, 56, 15));
        SurnameLabel.setText("No Data");
        SurnameLabel.setBounds(new Rectangle(277, 99, 65, 15));
        NameLabel.setText("No Data");
        NameLabel.setBounds(new Rectangle(277, 127, 65, 15));
        AddressLabel.setText("No Data");
        AddressLabel.setBounds(new Rectangle(277, 158, 65, 15));
        Change.setText("Change Infos");
        Change.addActionListener(new PurseNew_Change_actionAdapter(this));
        PhotoField.setText("");
        PhotoField.setBounds(new Rectangle(170, 54, 101, 20));
        ChangeInfosPanel.setLayout(null);
        jLabel5.setText("Photo path");
        jLabel5.setBounds(new Rectangle(49, 59, 94, 15));
        jLabel6.setText("Name");
        jLabel6.setBounds(new Rectangle(49, 91, 69, 15));
        jLabel7.setText("Surname");
        jLabel7.setBounds(new Rectangle(49, 127, 69, 15));
        jLabel8.setText("Address");
        jLabel8.setBounds(new Rectangle(49, 159, 69, 15));
        NameField.setBounds(new Rectangle(170, 86, 103, 20));
        SurnameField.setToolTipText("");
        SurnameField.setBounds(new Rectangle(170, 122, 103, 20));
        AddressField.setBounds(new Rectangle(170, 154, 103, 20));
        Set.setBounds(new Rectangle(135, 203, 96, 23));
        Set.setText("Set");
        Set.addActionListener(new PurseNew_Set_actionAdapter(this));
        Browse.setBounds(new Rectangle(286, 53, 46, 23));
        Browse.setText("...");
        jLabel9.setText("Current Ballance");
        jLabel9.setBounds(new Rectangle(68, 179, 113, 15));
        ChangePINPanel.setLayout(null);
        jTextPane4.setFont(new java.awt.Font("Dialog", Font.BOLD, 22));
        jTextPane4.setPreferredSize(new Dimension(140, 35));
        jTextPane4.setText("Change PIN");
        jTextPane4.setBounds(new Rectangle(135, 19, 131, 41));
        Management.setText("Management");
        PINChange.setText("Change PIN");
        PINChange.addActionListener(new PurseNew_ShowMiles_actionAdapter(this));
        AccNoLabel.setHorizontalAlignment(SwingConstants.CENTER);
        AccNoLabel.setText("Account Number");
        AccNoLabel.setBounds(new Rectangle(51, 109, 131, 15));
        jLabel10.setText("Insert old PIN");
        jLabel10.setBounds(new Rectangle(70, 101, 116, 15));
        jLabel11.setText("Enter new PIN");
        jLabel11.setBounds(new Rectangle(70, 134, 116, 15));
        jLabel12.setText("Re-enter new PIN");
        jLabel12.setBounds(new Rectangle(70, 166, 116, 15));
        oldPINField.setBounds(new Rectangle(220, 94, 116, 22));
        newPINField1.setBounds(new Rectangle(220, 127, 116, 22));
        newPINField2.setBounds(new Rectangle(220, 159, 116, 22));
        GoChangePIN.setBounds(new Rectangle(155, 216, 91, 23));
        GoChangePIN.setText("Change");
        GoChangePIN.addActionListener(new PurseNew_GoChangePIN_actionAdapter(this));
        PINValidationPanel.add(jTextPane2);
        PINValidationPanel.add(PassField);
        PINValidationPanel.add(GoValidate);
        PINValidationPanel.add(InsertPIN);
        PINValidationPanel.add(ResultLabel);
        MainMenu.add(File);
        MainMenu.add(Connection);
        MainMenu.add(Processes);
        Connection.add(Connect);
        Connection.add(Disconnect);
        File.add(LogIn);
        File.addSeparator();
        File.add(Exit);
        Processes.add(Transactions);
        Processes.add(User);
        Processes.add(Management);
        TransactionsPanel.add(CreditBox);
        TransactionsPanel.add(DebitBox);
        TransactionsPanel.add(BallanceBox);
        TransactionsPanel.add(GoCredit);
        TransactionsPanel.add(GoDebit);
        TransactionsPanel.add(jTextPane1);
        TransactionsPanel.add(jLabel9);
        AccountPanel.add(SetAccNo);
        AccountPanel.add(jTextPane3);
        AccountPanel.add(CurrentAccNo);
        AccountPanel.add(NewAccNo);
        AccountPanel.add(AccResults);
        AccountPanel.add(AccNoLabel);
        UserPanel.add(jLabel1);
        UserPanel.add(jLabel2);
        UserPanel.add(SurnameLabel);
        UserPanel.add(NameLabel);
        UserPanel.add(jLabel3);
        UserPanel.add(ImageLabel);
        UserPanel.add(jLabel4);
        UserPanel.add(AddressLabel);
        ChangeInfosPanel.add(Set);
        ChangeInfosPanel.add(NameField);
        ChangeInfosPanel.add(jLabel6);
        ChangeInfosPanel.add(jLabel8);
        ChangeInfosPanel.add(AddressField);
        ChangeInfosPanel.add(SurnameField);
        ChangeInfosPanel.add(jLabel7);
        ChangeInfosPanel.add(PhotoField);
        ChangeInfosPanel.add(jLabel5);
        ChangeInfosPanel.add(Browse);
        ChangePINPanel.add(jTextPane4);
        ChangePINPanel.add(oldPINField);
        ChangePINPanel.add(jLabel10);
        ChangePINPanel.add(jLabel11);
        ChangePINPanel.add(jLabel12);
        ChangePINPanel.add(newPINField1);
        ChangePINPanel.add(newPINField2);
        ChangePINPanel.add(GoChangePIN);
        Management.add(PINChange);
        Management.add(Account);
        Management.add(Change);
    }

    public void Connect_actionPerformed(ActionEvent e) {
        try {
            byte[] AID = {
                            (byte)0xA0, (byte)0x00, (byte)0x00,
                            (byte)0x00, (byte)0x62, (byte)0x03, (byte)0x01,
                            (byte)0x0C, (byte)0x08, (byte)0x01
            };
            PC.startFramework();
            PC.connectToCard();
            PC.selectApplet(AID);

            Connect.setEnabled(false);
            Disconnect.setEnabled(true);
            this.setTitle("Java Card Rules!! - Connected");
        }catch(Exception ex){
            JOptionPane.showMessageDialog(this,
                                          ex.getMessage(),
                                          "Warning",
                                          JOptionPane.WARNING_MESSAGE);
        }
    }

    public void Disconnect_actionPerformed(ActionEvent e) {
        try {
            PC.stopFramework();
            Connect.setEnabled(true);
            Disconnect.setEnabled(false);
            CreditBox.setText("");
            DebitBox.setText("");
            BallanceBox.setText("");
            this.setTitle("Java Card Rules!! - Disconnected");
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this,
                                          ex.getMessage(),
                                          "Warning",
                                          JOptionPane.WARNING_MESSAGE);
        }
    }

    public void this_windowClosing(WindowEvent e) {
        try {
            PC.stopFramework();
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this,
                                          ex.getMessage(),
                                          "Warning",
                                          JOptionPane.WARNING_MESSAGE);
        } finally {
            System.exit(0);
        }
    }

    public void Exit_actionPerformed(ActionEvent e) {
        try {
            PC.stopFramework();
        } catch (Exception ex) {
        } finally {
            System.exit(0);
        }
    }

    public void LogIn_actionPerformed(ActionEvent e) {
        this.getContentPane().remove(getContentPane().getComponent(0));
        this.getContentPane().add(PINValidationPanel);
        this.getContentPane().validate();
        this.getContentPane().repaint();
    }

    public void Transactions_actionPerformed(ActionEvent e) {
        this.getContentPane().remove(getContentPane().getComponent(0));
        this.getContentPane().add(TransactionsPanel);
        this.getContentPane().validate();
        this.getContentPane().repaint();
    }

    public void Account_actionPerformed(ActionEvent e) {
        this.getContentPane().remove(getContentPane().getComponent(0));
        this.getContentPane().add(AccountPanel);
        this.getContentPane().validate();
        this.getContentPane().repaint();
    }

    public void User_actionPerformed(ActionEvent e) {
        this.getContentPane().remove(getContentPane().getComponent(0));
        this.getContentPane().add(UserPanel);
        this.getContentPane().validate();
        this.getContentPane().repaint();
    }

    public void Change_actionPerformed(ActionEvent e) {
        this.getContentPane().remove(getContentPane().getComponent(0));
        this.getContentPane().add(ChangeInfosPanel);
        this.getContentPane().validate();
        this.getContentPane().repaint();
    }

    public void ShowMiles_actionPerformed(ActionEvent e) {
        this.getContentPane().remove(getContentPane().getComponent(0));
        this.getContentPane().add(ChangePINPanel);
        this.getContentPane().validate();
        this.getContentPane().repaint();
    }

    public void GoValidate_actionPerformed(ActionEvent e) {
        char[] Password = PassField.getPassword();
        try{
            if(PC.validate(Password))
                ResultLabel.setText("Authentication succeed");
            else ResultLabel.setText("Authentication failed");

            String getInfo = PC.getBalance();
            if(getInfo != null) BallanceBox.setText(getInfo);
            getInfo = PC.getAccountNumber();
            if(getInfo != null) CurrentAccNo.setText(getInfo);
            getInfo = PC.getUserSurname();
            if(getInfo != null) SurnameLabel.setText(getInfo);
            getInfo = PC.getUserName();
            if(getInfo != null) NameLabel.setText(getInfo);
            getInfo = PC.getUserAddress();
            if(getInfo != null) AddressLabel.setText(getInfo);

        }catch(Exception ex){
            JOptionPane.showMessageDialog(this,
                                          ex.getMessage(),
                                          "Warning",
                                          JOptionPane.WARNING_MESSAGE);
        }finally{
            Arrays.fill(Password,'0');
        }
    }

    public void SetAccNo_actionPerformed(ActionEvent e) {
        try{
            PC.setAccountNumber(NewAccNo.getText());
            CurrentAccNo.setText(PC.getAccountNumber());
        }catch(Exception ex){
            JOptionPane.showMessageDialog(this,
                                          ex.getMessage(),
                                          "Warning",
                                          JOptionPane.WARNING_MESSAGE);
        }
    }

    public void GoCredit_actionPerformed(ActionEvent e) {
        try{
            PC.credit(CreditBox.getText());
            BallanceBox.setText(PC.getBalance());
        }catch(NumberFormatException ex){
            JOptionPane.showMessageDialog(this,
                                          "Empty String",
                                          "Warning",
                                          JOptionPane.WARNING_MESSAGE);
        }catch(Exception ex){
            ex.printStackTrace();
            JOptionPane.showMessageDialog(this,
                                          ex.getMessage(),
                                          "Warning",
                                          JOptionPane.WARNING_MESSAGE);
        }
    }

    public void GoDebit_actionPerformed(ActionEvent e) {
        try{
            PC.debit(DebitBox.getText());
            BallanceBox.setText(PC.getBalance());
        }catch(Exception ex){
            JOptionPane.showMessageDialog(this,
                                          ex.getMessage(),
                                          "Warning",
                                          JOptionPane.WARNING_MESSAGE);
        }
    }

    public void Set_actionPerformed(ActionEvent e) {
        try{
            PC.setUserSurname(SurnameField.getText());
            PC.setUserName(NameField.getText());
            PC.setUserAddress(AddressField.getText());

            String getInfo = PC.getUserSurname();
            if(getInfo != null) SurnameLabel.setText(getInfo);
            getInfo = PC.getUserName();
            if(getInfo != null) NameLabel.setText(getInfo);
            getInfo = PC.getUserAddress();
            if(getInfo != null) AddressLabel.setText(getInfo);
        }catch(Exception ex){
            JOptionPane.showMessageDialog(this,
                                          ex.getMessage(),
                                          "Warning",
                                          JOptionPane.WARNING_MESSAGE);
        }
    }

    public void GoChangePIN_actionPerformed(ActionEvent e) {
        char[] newPIN = newPINField1.getPassword();
        char[] newPINconf = newPINField2.getPassword();
        if(Arrays.equals(newPIN,newPINconf)){
            char[] oldPIN = oldPINField.getPassword();
            try{
                PC.changePIN(oldPIN,newPIN);
            }catch(Exception ex){
                JOptionPane.showMessageDialog(this,
                                              ex.getMessage(),
                                              "Warning",
                                          JOptionPane.WARNING_MESSAGE);
            }finally{
                Arrays.fill(oldPIN,'0');
            }
        }else{
        JOptionPane.showMessageDialog(this,
                          "Please check your new PIN",
                          "Warning",
                      JOptionPane.WARNING_MESSAGE);
        Arrays.fill(newPIN,'0');
        Arrays.fill(newPINconf,'0');
        }

    }

}


class PurseNew_GoChangePIN_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_GoChangePIN_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.GoChangePIN_actionPerformed(e);
    }
}


class PurseNew_Set_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_Set_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.Set_actionPerformed(e);
    }
}


class PurseNew_GoDebit_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_GoDebit_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.GoDebit_actionPerformed(e);
    }
}


class PurseNew_GoCredit_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_GoCredit_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.GoCredit_actionPerformed(e);
    }
}


class PurseNew_SetAccNo_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_SetAccNo_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.SetAccNo_actionPerformed(e);
    }
}


class PurseNew_GoValidate_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_GoValidate_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.GoValidate_actionPerformed(e);
    }
}


class PurseNew_ShowMiles_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_ShowMiles_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.ShowMiles_actionPerformed(e);
    }
}


class PurseNew_Change_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_Change_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.Change_actionPerformed(e);
    }
}


class PurseNew_User_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_User_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.User_actionPerformed(e);
    }
}


class PurseNew_Account_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_Account_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.Account_actionPerformed(e);
    }
}


class PurseNew_Transactions_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_Transactions_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.Transactions_actionPerformed(e);
    }
}


class PurseNew_LogIn_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_LogIn_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.LogIn_actionPerformed(e);
    }
}


class PurseNew_Exit_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_Exit_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.Exit_actionPerformed(e);
    }
}


class PurseNew_this_windowAdapter extends WindowAdapter {
    private PurseNew adaptee;
    PurseNew_this_windowAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void windowClosing(WindowEvent e) {
        adaptee.this_windowClosing(e);
    }
}


class PurseNew_Disconnect_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_Disconnect_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.Disconnect_actionPerformed(e);
    }
}


class PurseNew_Connect_actionAdapter implements ActionListener {
    private PurseNew adaptee;
    PurseNew_Connect_actionAdapter(PurseNew adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.Connect_actionPerformed(e);
    }
}
