/* * ThreadedFrame.java * * Created on April 21, 2005, 3:03 PM */ /** * * @author levenick */ public class ThreadedFrame extends java.awt.Frame { private Controller theController; private int counter; public void incCounter() {counter++;} Thread aThread; /** Creates a new instance of ThreadedFrame */ public ThreadedFrame() { theController = new Controller(this); theController.start(); show(); setBounds(10,10,200,200); } public void paint(java.awt.Graphics g) { g.drawString(""+counter, 100, 100); } /** 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 addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } }); pack(); }//GEN-END:initComponents /** 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 ThreadedFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables }