/* * BallApplet.java * * Created on July 9, 2004, 11:38 AM */ /** * * @author levenick */ import java.awt.*; public class MoleculeApplet extends java.applet.Applet { Controller theController; public static final int WIDTH=900; public static final int HT=900; /** Initializes the applet BallApplet */ public void init() { initComponents(); theController = new Controller(this); theController.start(); } /*public void update(Graphics g) { paint(g); }*/ public void paint(Graphics g) { g.drawRect(0,0,WIDTH,HT); theController.paint(g); } /** 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 toggleButton = new java.awt.Button(); setLayout(null); toggleButton.setLabel("stop"); toggleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { toggleButtonActionPerformed(evt); } }); add(toggleButton); toggleButton.setBounds(440, 160, 80, 50); }//GEN-END:initComponents private void toggleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toggleButtonActionPerformed theController.toggleRunning(); if (theController.getRunning()) toggleButton.setLabel("stop"); else toggleButton.setLabel("go"); }//GEN-LAST:event_toggleButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private java.awt.Button toggleButton; // End of variables declaration//GEN-END:variables }