import java.awt.*;
import javax.swing.*;
public class  BankAccountPanel extends JPanel {
	// The components needed to be used outside of this class
	private JTextField nameTextField;
	private JTextField addressTextField;
	private JTextField phoneTextField;

	// Make a get method so that the name/address/phone can be accessed externally
	public JTextField getNameTextField() { return nameTextField; }
	public JTextField getAddressTextField() { return addressTextField; }
	public JTextField getPhoneTextField() { return phoneTextField; }

	// Add a constructor that takes a BankAccount, so that we can populate the text fields
	public BankAccountPanel (BankAccount account) {
		
		// Fill in the text fields with bank account's information
		nameTextField = new JTextField(account.getName());
		addressTextField = new JTextField(account.getAddress());
		phoneTextField = new JTextField(account.getPhone());
		
		JTextField accField = new JTextField(String.valueOf(account.getAccountNumber()));
		JTextField balField = new JTextField(String.valueOf(account.getBalance()));

		// Disallow changing of balance and account number
		accField.setEnabled(false);
		balField.setEnabled(false);

		// Set the layoutManager and add the components
		setLayout(new GridLayout(5,3,5,5));
		add(new JLabel("Name:"));
		add(nameTextField);
		add(new JLabel("Address:"));
		add(addressTextField);
		add(new JLabel("Phone Number:"));
		add(phoneTextField);
		add(new JLabel("Account #:"));
		add(accField);
		add(new JLabel("Balance:"));
		add(balField);
	}
}