All pastes #124099 Raw Edit

staulkor

public java v1 · immutable
·published 2006-08-09 20:35 UTC
rendered paste body
import javax.swing.*;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;public class BankAccountGUI {    private JTextField addField;    private JButton addButton;    private JTabbedPane tabbedPane1;    private JPanel panel1;    private JTextField balanceField;    private JTextField removeField;    private JButton checkBalanceButton;    private JButton removeButton;    double balance = 0;    public BankAccountGUI() {        addButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                balance += Double.valueOf(addField.getText()).doubleValue();            }        });        checkBalanceButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                balanceField.setText(Double.toString(balance));            }        });        removeButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent e) {                balance -= Double.valueOf(removeField.getText()).doubleValue();            }        });    }    public static void main(String[] args) {        JFrame frame = new JFrame("BankAccountGUI");        frame.setContentPane(new BankAccountGUI().panel1);        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        frame.pack();        frame.setVisible(true);    }}