/* * NoClassAccountApplet.java * * Created on April 20, 2005, 8:53 PM */ /** * * @author levenick */ public class NoClassAccountApplet extends java.applet.Applet { int balance = 1000; /** Initializes the applet NoClassAccountApplet */ public void init() { try { java.awt.EventQueue.invokeAndWait(new Runnable() { public void run() { initComponents(); } }); } catch (Exception ex) { ex.printStackTrace(); } } /** This method is called from within the init() method 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 button1 = new java.awt.Button(); textField1 = new java.awt.TextField(); setLayout(null); button1.setLabel("button1"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { button1ActionPerformed(evt); } }); add(button1); button1.setBounds(80, 70, 57, 24); add(textField1); textField1.setBounds(210, 70, 60, 20); }//GEN-END:initComponents private void button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button1ActionPerformed int withdrawal = Integer.parseInt(textField1.getText()); System.out.println("withdraw=" + withdrawal); balance = balance - withdrawal; System.out.println("new balance=" + balance); }//GEN-LAST:event_button1ActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private java.awt.Button button1; private java.awt.TextField textField1; // End of variables declaration//GEN-END:variables }