import java.awt.*; import java.awt.event.*; import OthelloGUIv1; /** * Startup class for the Othello GUI */ public class Startup extends WindowAdapter implements ActionListener { // +--------+-------------------------------------------------- // | Fields | // +--------+ /** Important frame to initialize the game */ protected static Frame initialoptions; /** prompt user for number of players */ protected static Label number; /** This is a place for the user to enter the number of players */ protected static TextField players; /** An okay button for after the user enters the number of players */ protected static Button okay; // +----------------+----------------------------------------- // | Constructors | // +----------------+ /** The first window that opens, and asks for initialization of options */ protected Startup() { initialoptions = new Frame("Welcome to Grinnello, here are some options:"); initialoptions.setLayout(new FlowLayout()); number = new Label("How many players will there be today?"); players = new TextField(" "); okay = new Button("OK"); okay.addActionListener(this); initialoptions.add(number); initialoptions.add(players); initialoptions.add(okay); initialoptions.pack(); initialoptions.show(); } // initialOptions(); // +----------------+----------------------------------------- // | Event Handlers | // +----------------+ public void actionPerformed(ActionEvent evt) { String command = evt.getActionCommand(); // Action Listener for initial options' "okay" if (command.equals("OK")) { // start the main window and close this one initialoptions.dispose(); new OthelloGUIv1(); } // if OK } // actionPerformed public void windowClosing(WindowEvent event) { initialoptions.dispose(); System.exit(0); } // windowClosing(WindowEvent) // +-------------+-------------------------------------------- // | Main Method | // +-------------+ public static void main(String[] args) { // get the ball rolling new Startup(); } // main(String[]) } // class Startup