-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectCont.java
89 lines (79 loc) · 2.33 KB
/
SelectCont.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
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 javax.swing.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
/* Controller : セレクト画面に対する */
class SelectCont implements ActionListener, KeyListener {
public Game frame;
// コンストラクタ
public SelectCont(Game g) {
frame = g;
frame.addKeyListener(this);
frame.sl_view.b1.addActionListener(this);
frame.sl_view.b1.setActionCommand("sw+");
frame.sl_view.b2.addActionListener(this);
frame.sl_view.b2.setActionCommand("sw-");
frame.sl_view.b3.addActionListener(this);
frame.sl_view.b3.setActionCommand("ha+");
frame.sl_view.b4.addActionListener(this);
frame.sl_view.b4.setActionCommand("ha-");
frame.sl_view.b5.addActionListener(this);
frame.sl_view.b5.setActionCommand("st+");
frame.sl_view.b6.addActionListener(this);
frame.sl_view.b6.setActionCommand("st-");
frame.sl_view.b7.addActionListener(this);
frame.sl_view.b7.setActionCommand("bo+");
frame.sl_view.b8.addActionListener(this);
frame.sl_view.b8.setActionCommand("bo-");
frame.sl_view.b9.addActionListener(this);
frame.sl_view.b9.setActionCommand("decide");
frame.sl_view.b10.addActionListener(this);
frame.sl_view.b10.setActionCommand("modoru");
}
// キーを取り外す
public void remove() {
frame.removeKeyListener(this);
}
// ボタンの操作
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
if (cmd.equals("sw+")) {
frame.select.push_plus(1);
return;
} else if (cmd.equals("sw-")) {
frame.select.push_minus(1);
return;
} else if (cmd.equals("ha+")) {
frame.select.push_plus(2);
return;
} else if (cmd.equals("ha-")) {
frame.select.push_minus(2);
return;
} else if (cmd.equals("st+")) {
frame.select.push_plus(3);
return;
} else if (cmd.equals("st-")) {
frame.select.push_minus(3);
return;
} else if (cmd.equals("bo+")) {
frame.select.push_plus(4);
return;
} else if (cmd.equals("bo-")) {
frame.select.push_minus(4);
return;
} else if (cmd.equals("decide")) {
frame.select_maze();
return;
} else if (cmd.equals("modoru")) {
frame.pushreturn();
return;
}
}
// キーの操作
public void keyPressed(KeyEvent e) {
}
public void keyTyped(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
}
}