// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) space 
// Source File Name:   GameOverDialog.java

package view;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

// Referenced classes of package view:
//      TicTacToeFrame

public class GameOverDialog extends JDialog
{

  public GameOverDialog(TicTacToeFrame tictactoeframe)
  {
    super(tictactoeframe);
    panel1 = new JPanel();
    borderLayout1 = new BorderLayout();
    jLabel1 = new JLabel();
    jPanel1 = new JPanel();
    quitBtn = new JButton();
    restartBtn = new JButton();
    try
    {
      jbInit();
      pack();
      setLocation((tictactoeframe.getLocation().x + tictactoeframe.getWidth() / 2) - getWidth() / 2, (tictactoeframe.getLocation().y + tictactoeframe.getHeight() / 2) - getHeight() / 2);
    }
    catch (Exception exception)
    {
      exception.printStackTrace();
    }
  }

  void jbInit()
    throws Exception
  {
    panel1.setLayout(borderLayout1);
    jLabel1.setBackground(Color.red);
    jLabel1.setFont(new Font("Dialog", 0, 24));
    jLabel1.setOpaque(true);
    jLabel1.setHorizontalAlignment(0);
    jLabel1.setHorizontalTextPosition(2);
    jLabel1.setText("The computer has won!");
    quitBtn.setText("Quit");
    quitBtn.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent actionevent)
      {
        quitBtn_actionPerformed(actionevent);
      }

    });
    restartBtn.setText("Restart");
    restartBtn.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent actionevent)
      {
        restartBtn_actionPerformed(actionevent);
      }

    });
    setResizable(false);
    getContentPane().setBackground(SystemColor.control);
    setModal(true);
    setTitle("Game Over.");
    jPanel1.setBackground(Color.cyan);
    getContentPane().add(panel1);
    panel1.add(jLabel1, "North");
    panel1.add(jPanel1, "Center");
    jPanel1.add(quitBtn, null);
    jPanel1.add(restartBtn, null);
  }

  void draw()
  {
    jLabel1.setText("It's a Draw!");
    show();
  }

  void playerWon(String s)
  {
    jLabel1.setText(s + " has won!");
    show();
  }

  void quitBtn_actionPerformed(ActionEvent actionevent)
  {
    dispose();
    ((TicTacToeFrame)getOwner()).exit();
  }

  void restartBtn_actionPerformed(ActionEvent actionevent)
  {
    dispose();
    ((TicTacToeFrame)getOwner()).resetAll();
  }

  JPanel panel1;
  BorderLayout borderLayout1;
  JLabel jLabel1;
  JPanel jPanel1;
  JButton quitBtn;
  JButton restartBtn;
}
