aboutsummaryrefslogtreecommitdiff
path: root/KeyDetection.java
diff options
context:
space:
mode:
authorAidan Ross <aross02@fairport.org>2023-05-02 12:54:52 +0000
committerAidan Ross <aross02@fairport.org>2023-05-02 12:54:52 +0000
commitb3182076fca55898685558915eb470c547c0caee (patch)
tree40770820f15537388cdf0e981c715d846caf087b /KeyDetection.java
parent9198faa9569aa11d016b99db4e3712841e4f0b99 (diff)
downloadNPEhero-b3182076fca55898685558915eb470c547c0caee.tar.gz
NPEhero-b3182076fca55898685558915eb470c547c0caee.tar.bz2
NPEhero-b3182076fca55898685558915eb470c547c0caee.zip
These two classes are used to create a gui with 4 lanes and buttons that activate when you press the keys d,f,h, and j
Diffstat (limited to 'KeyDetection.java')
-rw-r--r--KeyDetection.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/KeyDetection.java b/KeyDetection.java
new file mode 100644
index 0000000..429665a
--- /dev/null
+++ b/KeyDetection.java
@@ -0,0 +1,27 @@
+/*Name:
+ *Date:
+ *Period:
+ *Teacher:
+ *Description:
+ */
+package cs;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+
+public class KeyDetection extends AbstractAction
+{
+ long timeStart = System.currentTimeMillis();
+ private char key;
+ public KeyDetection(char ch){
+ key = ch;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+ int time = (int)((System.currentTimeMillis()-timeStart));
+ System.out.println(key + ": " + time);
+ }
+
+}