aboutsummaryrefslogtreecommitdiff
path: root/KeyDetection.java
diff options
context:
space:
mode:
authorAidan Ross <aross02@fairport.org>2023-05-03 12:56:39 +0000
committerAidan Ross <aross02@fairport.org>2023-05-03 12:56:39 +0000
commitff2fa62df5e80f9ef053297afdd65254b5044d60 (patch)
tree33ed6c3b45b2bb131b55b0a53f7a61804fa345d9 /KeyDetection.java
parentbbd867a635cb931a7cd36ddc960ab1a3911ae827 (diff)
downloadNPEhero-ff2fa62df5e80f9ef053297afdd65254b5044d60.tar.gz
NPEhero-ff2fa62df5e80f9ef053297afdd65254b5044d60.tar.bz2
NPEhero-ff2fa62df5e80f9ef053297afdd65254b5044d60.zip
Very rudimentary code for making an object fall from the top of the screen
Diffstat (limited to 'KeyDetection.java')
-rw-r--r--KeyDetection.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/KeyDetection.java b/KeyDetection.java
new file mode 100644
index 0000000..98f96e4
--- /dev/null
+++ b/KeyDetection.java
@@ -0,0 +1,28 @@
+/*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);
+
+ }
+
+}