import util.*;
import frameeditor.*;
import tictactoe.*;
import tictactoe.pres.*;
import tictactoe.app.*;
import tictactoe.trans.*;
import saveopen.presentation.*;
import saveopen.translation.*;
import javax.swing.*;
import java.awt.event.*;

public class FrameEditorTester extends JFrame implements ActionListener{
    
    private static long startTime;

    public FrameEditorTester(ActionFrame editor) {
        startTime = System.currentTimeMillis();
        editor.addActionListener(this);     // Test code is in charge
                                            // of handling "Quit"s.
    }
    
    public static void main (String[] args) {
	TTTFrame gameFrame = new TTTFrame(true);
	TTTApplication gameApp = new TTTApplication();
	TTTHandler gameHandler = new TTTHandler(gameFrame, gameApp);
        ActionFrame editFrame = new FrameEditor(gameFrame);
                                // Your constructor will have to
                                // register editFrame as ActionListener
                                // with gameFrame.
        editFrame.pack();
        editFrame.setVisible(true);
        editFrame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    doQuit();
                }});
        JFrame f = new FrameEditorTester(editFrame);
    }
    
    public void actionPerformed (ActionEvent e) {
        // Process "Quit" ActionCommand from editFrame.
        String s = e.getActionCommand();
        if (s != null)
            if (s.equals("Quit"))
                doQuit();
    }
    
    public static void doQuit() {
        System.out.println("Total elapsed time: " + ((System.currentTimeMillis() - startTime)/1000) + " seconds.");
        System.exit(0);
    }
}

