// file: TransformBuilder.java
//

// import necessary java libraries
//
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.io.*;

/**
 * class that is the driver of program
 */
public class TransformBuilder implements Constants {

    // declare global variables
    //
    private static DiGraph digraph = null;

    // declare main program
    //
    public static void main(String[] args) {
	
	// create a vertex box panel
	//
	digraph = new DiGraph("Transform Builder");

	// listen for window closing events
	//
	digraph.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {System.exit(0);}
        });

	// resize and set the frame dimensions
	//
	digraph.pack();

	// center the frame to the screen
	//
	Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); 
	Rectangle frameDim = digraph.getBounds(); 
	digraph.setLocation((screenDim.width - frameDim.width) / 2,
		    (screenDim.height - frameDim.height) / 2); 
	
	// parse command line 
	//
	if (args.length == 1) {
	    File param_file = new File(args[0]);
	    
	    if (param_file.canRead()) {
		digraph.paramFile = param_file;
		digraph.read();
	    }
	    else {
		System.out.println("Cannot read file "+args[0]+"\n");
	    }
	} else if (args.length > 1) {
	    System.out.println("You can only specify one filename\n");
	}

	// display the frame
	//
	digraph.setVisible(true);	

    }
} 

//
// end of file
