diff options
author | Aidan Ross <aross02@fairport.org> | 2023-05-02 12:54:52 +0000 |
---|---|---|
committer | Aidan Ross <aross02@fairport.org> | 2023-05-02 12:54:52 +0000 |
commit | b3182076fca55898685558915eb470c547c0caee (patch) | |
tree | 40770820f15537388cdf0e981c715d846caf087b /KeyDetection.java | |
parent | 9198faa9569aa11d016b99db4e3712841e4f0b99 (diff) | |
download | NPEhero-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.java | 27 |
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); + } + +} |