Guest User

Untitled

a guest
Oct 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package nicholascagestarringinspaceoff;
  7.  
  8. import java.awt.event.KeyEvent;
  9. import java.awt.event.KeyListener;
  10.  
  11. /**
  12. *
  13. * @author James
  14. */
  15. public class NicholasCageStarringInSpaceOff implements KeyListener {
  16.  
  17. private int spaceCount = 0;
  18.  
  19. /**
  20. * @param args the command line arguments
  21. */
  22. public static void main(String[] args) {
  23. System.out.println("Ready");
  24. try {
  25. Thread.sleep(500);
  26. } catch (InterruptedException ex) {
  27. Thread.currentThread().interrupt();
  28. }
  29. System.out.println("Set");
  30. try {
  31. Thread.sleep(500);
  32. } catch (InterruptedException ex) {
  33. Thread.currentThread().interrupt();
  34. }
  35. System.out.println("Go");
  36. try {
  37. Thread.sleep(500);
  38. } catch (InterruptedException ex) {
  39. Thread.currentThread().interrupt();
  40. }
  41.  
  42. }
  43.  
  44. @Override
  45. public void keyTyped(KeyEvent e) {
  46. }
  47.  
  48. @Override
  49. public void keyPressed(KeyEvent e) {
  50. if (e.getKeyCode() == KeyEvent.VK_SPACE) {
  51. addToCount();
  52. }
  53. }
  54.  
  55. @Override
  56. public void keyReleased(KeyEvent e) {
  57. this.spaceCount++;
  58. System.out.println(this.spaceCount);
  59. }
  60.  
  61. /**
  62. * Adds to the key press count
  63. */
  64. public void addToCount() {
  65.  
  66. }
  67.  
  68. }
Add Comment
Please, Sign In to add comment