import finch.Finch; import java.io.*; import java.util.*; import javax.swing.JFrame; /* * Driver for the project 4 implementation: creates a window for * viewing/manipulating a master list of Finch Actions and then waits * for the program to terminate. * * @author Andrew H. Fagg * */ public class FinchDriver { /** * Sleep for a specified amount of time. * * @param i Number of milliseconds to sleep */ static public void mySleep(int i) { try{ Thread.sleep(i); }catch(Exception e) { System.out.println(e); } } public static void main(String[] args) { Finch myFinch = null; // Comment out the next line if you wish to test your program without having // a Finch connected myFinch = new Finch(); // Create the master action list FinchData finchData = new FinchData(myFinch); ////////////////////////////////////////////////////////////////// // Create the display frame FinchDisplay2 display = new FinchDisplay2(finchData); //finchData.setDisplay(display); // Title display.setTitle("Finch Interface"); // Size of window display.setSize(600,400); // Set window location to middle of screen display.setLocationRelativeTo(null); // When window is closed: exit the program display.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); // Display the window display.setVisible(true); ////////////////////////////////////////////////////////////// // Loop until the main program quits while(display.getCloseFlag()){ mySleep(10); } // Clean up if(myFinch != null){ myFinch.stopWheels(); myFinch.quit(); }; // Close the program System.exit(0); }; }