/* * EditFrame.java * * Created on October 21, 2004, 11:56 AM */ /** * * @author levenick */ public class EditFrame extends java.awt.Frame { Account theAccount; /** Creates new form EditFrame */ public EditFrame(Account theAccount) { initComponents(); setBounds(500,100,300,300); this.theAccount = theAccount; nameTF.setText(theAccount.getName()); balanceTF.setText(""+theAccount.getBalance()); show(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents nameTF = new java.awt.TextField(); balanceTF = new java.awt.TextField(); label1 = new java.awt.Label(); label2 = new java.awt.Label(); setLayout(null); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } }); nameTF.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nameTFActionPerformed(evt); } }); add(nameTF); nameTF.setBounds(40, 80, 80, 20); balanceTF.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { balanceTFActionPerformed(evt); } }); add(balanceTF); balanceTF.setBounds(190, 80, 60, 20); label1.setText("Name"); add(label1); label1.setBounds(40, 40, 40, 20); label2.setText("Balance"); add(label2); label2.setBounds(190, 40, 60, 20); pack(); }//GEN-END:initComponents private void balanceTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_balanceTFActionPerformed theAccount.setBalance(Integer.parseInt(balanceTF.getText())); }//GEN-LAST:event_balanceTFActionPerformed private void nameTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nameTFActionPerformed theAccount.setName(nameTF.getText()); }//GEN-LAST:event_nameTFActionPerformed /** Exit the Application */ private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm setVisible(false);; }//GEN-LAST:event_exitForm // Variables declaration - do not modify//GEN-BEGIN:variables private java.awt.TextField balanceTF; private java.awt.Label label1; private java.awt.Label label2; private java.awt.TextField nameTF; // End of variables declaration//GEN-END:variables }