-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathYahtzee.java
More file actions
44 lines (31 loc) · 910 Bytes
/
Copy pathYahtzee.java
File metadata and controls
44 lines (31 loc) · 910 Bytes
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
//Bret Owens - bto14
//Alex Sumner - acs14k
import javax.swing.*;
import java.awt.Color;
import java.awt.event.*;
public class Yahtzee extends JFrame{ //Setup for basic frame of game
private JDesktopPane Pane;
public Yahtzee()
{
JMenuBar menu = new JMenuBar(); //Creates menu for main frame
JMenu add = new JMenu("Quit (Alt - q)");
add.setMnemonic('q');
JMenuItem item = new JMenuItem("Exit Program (Alt - x)");
item.setMnemonic('x');
add.add(item);
menu.add(add);
item.addActionListener( //Action listener for quit
new ActionListener() // anonymous inner class
{
public void actionPerformed( ActionEvent event )
{
System.exit(0);
}
});
setJMenuBar(menu);
Pane = new JDesktopPane(); //Main pane for game
setTitle("Yahtzee");
Pane.setBackground(Color.white);
getContentPane().add(Pane);
}
}