I can't get the compute button to work. Can someone help me?

AoC = new JTextField(); AoC.setBounds(157, 8, 86, 20); contentPane.add(AoC); AoC.setColumns(10); JLabel NumberOfYears = new JLabel("Number of Years"); NumberOfYears.setFont(new Font("Arial Black", Font.PLAIN, 10)); NumberOfYears.setBounds(43, 52, 104,... show more AoC = new JTextField();
AoC.setBounds(157, 8, 86, 20);
contentPane.add(AoC);
AoC.setColumns(10);

JLabel NumberOfYears = new JLabel("Number of Years");
NumberOfYears.setFont(new Font("Arial Black", Font.PLAIN, 10));
NumberOfYears.setBounds(43, 52, 104, 14);
contentPane.add(NumberOfYears);

Years = new JTextField();
Years.setBounds(157, 49, 86, 20);
contentPane.add(Years);
Years.setColumns(10);

final JButton Compute = new JButton("Compute");
Compute.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
double a = Double.parseDouble(Years.getText()) / 5.42227098;
double b = Math.pow(0.5, a);
double c = Double.parseDouble(AoC.getText()) * b;
AmountLeft.setText(Double.toString(...

}
}

);
Compute.setBounds(45, 77, 89, 23);
contentPane.add(Compute);

JButton Quit = new JButton("Quit");
Quit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
Quit.setBounds(154, 77, 89, 23);
contentPane.add(Quit);

JLabel AmountLeft = new JLabel("Amount Left:");
AmountLeft.setBounds(43, 137, 72, 14);
contentPane.add(AmountLeft);

JLabel Result = new JLabel("....");
Result.setBounds(158, 137, 46, 14);
contentPane.add(Result);

}
2 answers 2