From ff2fa62df5e80f9ef053297afdd65254b5044d60 Mon Sep 17 00:00:00 2001 From: Aidan Ross Date: Wed, 3 May 2023 12:56:39 +0000 Subject: Very rudimentary code for making an object fall from the top of the screen --- KeyDetection.java | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 KeyDetection.java (limited to 'KeyDetection.java') 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); + + } + +} -- cgit v1.2.3