Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package nicholascagestarringinspaceoff;
- import java.awt.event.KeyEvent;
- import java.awt.event.KeyListener;
- /**
- *
- * @author James
- */
- public class NicholasCageStarringInSpaceOff implements KeyListener {
- private int spaceCount = 0;
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- System.out.println("Ready");
- try {
- Thread.sleep(500);
- } catch (InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- System.out.println("Set");
- try {
- Thread.sleep(500);
- } catch (InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- System.out.println("Go");
- try {
- Thread.sleep(500);
- } catch (InterruptedException ex) {
- Thread.currentThread().interrupt();
- }
- }
- @Override
- public void keyTyped(KeyEvent e) {
- }
- @Override
- public void keyPressed(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_SPACE) {
- addToCount();
- }
- }
- @Override
- public void keyReleased(KeyEvent e) {
- this.spaceCount++;
- System.out.println(this.spaceCount);
- }
- /**
- * Adds to the key press count
- */
- public void addToCount() {
- }
- }
Add Comment
Please, Sign In to add comment