-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitch.java
More file actions
34 lines (28 loc) · 707 Bytes
/
Switch.java
File metadata and controls
34 lines (28 loc) · 707 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
import java.awt.Color;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
public class Switch extends Gate{
boolean value = false;
public void clicked() {
if (value == true) {
value = false;
}
else {
value = true;
}
}
public void copy() {
Main.nextGatePlacement = new Switch();
}
public boolean evaluate(boolean one, boolean two){
return value;
}
public Color getColor() {
return Color.CYAN;
}
static class action extends AbstractAction {
public void actionPerformed(ActionEvent e) {
Main.nextGatePlacement = new Switch();
}
}
}