/* * MoleculeFrame.java * * Created on April 22, 2005, 9:45 AM */ /** * * @author levenick */ import java.awt.*; public class MoleculeFrame extends Frame { Controller theController; public static final int WIDTH=900; public static final int HT=900; /** Creates new form MoleculeFrame */ public MoleculeFrame() { initComponents(); setSize(WIDTH, HT); 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 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 toggleButton = new java.awt.Button(); setLayout(null); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } }); toggleButton.setLabel("stop!"); toggleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { toggleButtonActionPerformed(evt); } }); add(toggleButton); toggleButton.setBounds(0, 0, 43, 24); pack(); }//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 /** Exit the Application */ private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm System.exit(0); }//GEN-LAST:event_exitForm /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MoleculeFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private java.awt.Button toggleButton; // End of variables declaration//GEN-END:variables }