-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuBar.java
More file actions
executable file
·89 lines (59 loc) · 2.26 KB
/
MenuBar.java
File metadata and controls
executable file
·89 lines (59 loc) · 2.26 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MenuBar extends JMenuBar
{
EngineInterface eInterface;
public MenuBar(EngineInterface e)
{
eInterface = e;
// ********** Game options ************//
JMenu menu = new JMenu("Game");
//add new game button
JMenuItem menuItem = new JMenuItem("New Game");
menuItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
eInterface.pipe("ucinewgame");
eInterface.boardPanel.setBoard();
}
});
menu.add(menuItem);
add(menu);
//*****************************************//
// ********** Engine options ************//
menu = new JMenu("Engine");
//add new engine button
menuItem = new JMenuItem("Load New Engine");
menuItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JFileChooser jfc = new JFileChooser("/Users/devinwieker/Desktop/ProgrammingProjects/ChessApp/engines/");
jfc.showOpenDialog(null);
File file = jfc.getSelectedFile();
eInterface.loadEngine(file.getAbsolutePath());
}
});
menu.add(menuItem);
add(menu);
//*****************************************//
//*************** View options *******************//
menu = new JMenu("View");
//add gui-engine log window and button
final Log commLog = new Log();
eInterface.attatchLog(commLog);
commLog.setSize(600, 300);
menuItem = new JMenuItem("Log");
menuItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
commLog.setVisible(true);
}
});
menu.add(menuItem);
add(menu);
add(new SettingsMenu());
}
}