/**
 * Created by stud on 18.06.2015.
 */
import javafx.event.ActionEvent;
import ru.mai.dep806.table.Table1;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.math.BigDecimal;

/**
 * Created by K_A_Volchica on 18.06.2015.
 */
public class SimplePanel extends JPanel{
    public JPanel panel;
    public JTextField number1;
    public JTextField currency;
    public JButton result;
    public JLabel number2;

    public SimplePanel()
    {
        setLayout(new BorderLayout());


        panel = new JPanel();


        number1=new JTextField("Quantity");
        panel.add(number1, BorderLayout.EAST);

        currency=new JTextField("Currency");
        panel.add(currency, BorderLayout.WEST);

        result=new JButton("Результат");
        panel.add(result,BorderLayout.NORTH);


        ActionListener command = result.addActionListener(new ActionListener(number1.getText(), currency.getText()));

        class command implements ActionListener
        {
            String a;
            String d;

            public command(String a, String d) {
                this.a=a;
                this.d=d;
            }
            }

            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {

                BigDecimal b= new BigDecimal(a);
                Quantity i = new Quantity(b, Kind.RUR);
                i.convert(b, Kind.RUR, d);

            number2=new JLabel(c.toString());
            panel.add(number2,BorderLayout.SOUTH);


            }


        }




}
