/* @(#)TicTacToeWithDialog.java   7 October 2008 */

import edu.neu.ccs.*;
import edu.neu.ccs.gui.*;

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;

public class TicTacToeWithDialog
    extends TicTacToe
{
    ////////////////////
    // Member Methods //
    ////////////////////
    
    /**
     * Overrides the inherited method to show a dialog
     * box at the point when one player wins the game.
     */
    protected Paintable checkForWinner() {
        // call the inherited method and
        // keep a reference to the block
        Paintable block = super.checkForWinner();
        
        // if the block is non-null there is a winner
        // so show a dialog
        if (block != null) {
            TileBox tile = new TileBox(block);
            tile.setBackgroundPaint(highColor);
            
            GeneralDialog.showOKDialog(tile, "Winner!");
        }
        
        // return the block
        // to match the behavior of the inherited method
        return block;
    }
    

    ///////////////////////////////////////////////////////
    // The method main: Entry point to start the program //
    ///////////////////////////////////////////////////////
    
    /** The main method. */
    public static void main(String[] args) {
        new TicTacToeWithDialog().frame("TicTacToeWithDialog");
    }
        
}

