I'm trying to create a program that will take a users input from a JTextField and add that input to an object of the class CurrentAccount after a JButton has been clicked. So far ive been able to come up with this code;

jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
//Execute when button is pressed
String currentValue = jTextField1.getText() ;
int val = Integer.parseInt(currentValue);
balance = val;
theAccount = new CurrentAccount(balance);


But i am only able to output 0 as the value isn't being stored as a parameter within the object of CurrentAccount. If you need my code for the class Current Account it is as follows.

public class CurrentAccount extends Account
private int myBalance;
// private final ControlPanel myPane;

private int balance;

public CurrentAccount(int myBalance)
balance= myBalance;


If anyone can help me with this i would be delighted and the help would be much appreciated.