package com.nameless.bank.frame;

import com.nameless.bank.logic.Account;
import com.nameless.bank.logic.Client;
import com.nameless.bank.logic.ManagementSystem;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * Created by  on 01.04.2016.
 */
public class AccountDialog extends JDialog implements ActionListener {
    private static final int D_HEIGHT = 150;
    private final static int D_WIDTH = 450;
    private final static int L_X = 10;
    private final static int L_W = 100;
    private final static int C_W = 150;
    private Client holder;
    private JLabel client = new JLabel();
    private JTextField money = new JTextField();
    public AccountDialog(Client cl){
        holder=cl;
        setTitle(" ");
        getContentPane().setLayout(new FlowLayout());
        getContentPane().setLayout(null);

        JLabel l = new JLabel(":", JLabel.RIGHT);
        l.setBounds(L_X, 30, L_W, 20);
        getContentPane().add(l);
        client.setBounds(L_X + L_W + 10, 30, C_W, 20);
        client.setText(cl.getName());
        getContentPane().add(client);

        l = new JLabel("", JLabel.RIGHT);
        l.setBounds(L_X, 50, L_W, 20);
        getContentPane().add(l);
        money.setBounds(L_X + L_W + 10, 50, C_W, 20);
        getContentPane().add(money);

        JButton btnOk = new JButton("OK");
        btnOk.setName("OK");
        btnOk.addActionListener(this);
        btnOk.setBounds(L_X + L_W + C_W + 10 + 50, 10, 100, 25);
        getContentPane().add(btnOk);

        JButton btnCancel = new JButton("Cancel");
        btnCancel.setName("Cancel");
        btnCancel.addActionListener(this);
        btnCancel.setBounds(L_X + L_W + C_W + 10 + 50, 40, 100, 25);
        getContentPane().add(btnCancel);

        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        setBounds(((int) d.getWidth() - AccountDialog.D_WIDTH) / 2, ((int) d.getHeight() - AccountDialog.D_HEIGHT) / 2,
                AccountDialog.D_WIDTH, AccountDialog.D_HEIGHT);
    }

    public Account getAccount(){
        Account acc = new Account();
        acc.setHolder(holder);
        acc.setMoney(Integer.parseInt(money.getText()));
        return acc;
    }

    public void actionPerformed(ActionEvent e) {
        JButton src = (JButton) e.getSource();
        if (src.getName().equals("OK")) {
            try {
                ManagementSystem.getInstance().addAccount(getAccount());
            } catch (Exception sql_e) {
                JOptionPane.showMessageDialog(this, sql_e.getMessage());
            }setVisible(false);
        }
        if (src.getName().equals("Cancel")) {
            setVisible(false);
        }
    }
}

@@ -301,16 +301,20 @@
 ated by 
+%D0%93%D0%BB%D0%B5%D0%B1
  on 01.0
@@ -809,17 +809,35 @@
 tTitle(%22
- 
+%D0%94%D0%BE%D0%B1%D0%B0%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5 %D0%B0%D0%BA%D0%BA%D0%B0%D1%83%D0%BD%D1%82%D0%B0
 %22);%0D%0A   
@@ -964,16 +964,22 @@
 JLabel(%22
+%D0%9A%D0%BB%D0%B8%D0%B5%D0%BD%D1%82
 :%22, JLab
@@ -1224,16 +1224,21 @@
 JLabel(%22
+%D0%92%D0%BA%D0%BB%D0%B0%D0%B4
 %22, JLabe

Update AccountDialog.java