-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettings.java
More file actions
52 lines (43 loc) · 1.47 KB
/
Settings.java
File metadata and controls
52 lines (43 loc) · 1.47 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
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Settings extends JPanel{
public Settings(ChessBoardPanel chessBoardPanel) {
setLayout(new FlowLayout(FlowLayout.CENTER));
JButton undoButton = new JButton("Undo");
JButton redoButton = new JButton("Redo");
JButton restartButton = new JButton("Restart");
JButton exitButton = new JButton("Exit");
// Add action listeners to buttons
undoButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Undo Clicked");
}
});
// Similarly, add listeners for redo, restart, and exit
redoButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// Redo
}
});
restartButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
chessBoardPanel.resetGame();
}
});
exitButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
add(undoButton);
add(redoButton);
add(restartButton);
add(exitButton);
}
}