-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChessGUI.java
59 lines (46 loc) · 1.77 KB
/
ChessGUI.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/****************************************************************************************************************************************************
* @Author: Corey M. Moura
* @Date: March 1, 2018
* @Professor: Dr. Trafftz
* @Project: Project 3 of CS163: Chess Game, player vs computer
* @Notes:
*
*
/****************************************************************************************************************************************************/
/** Libraries used for the creation of this GUI **/
import java.awt.*;
import javax.swing.*;
import java.awt.Button;
import java.util.Random;
import javax.swing.JFrame;
import java.awt.GridLayout;
import javax.swing.border.*;
import java.awt.event.ActionEvent;
import java.util.concurrent.TimeUnit;
import java.awt.event.ActionListener;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
public class ChessGUI extends JPanel{
public static void main(String[] args) {
JMenuBar menus;
JMenu fileMenu;
JMenuItem quitItem;
JMenuItem gameItem;
JFrame frame = new JFrame("Chess Game");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fileMenu = new JMenu("File");
quitItem = new JMenuItem("quit");
gameItem = new JMenuItem("new game");
fileMenu.add(gameItem);
fileMenu.add(quitItem);
menus = new JMenuBar();
frame.setJMenuBar(menus);
menus.add(fileMenu);
ChessPanel panel = new ChessPanel();
frame.getContentPane().add(panel);
frame.pack();
frame.setSize(400, 400);
frame.setVisible(true);
}
}