Advertisement
Guest User

KeyListener

a guest
Jan 28th, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.81 KB | None | 0 0
  1. switch (code) {
  2.         case 0:
  3.             if (inputKey == 0) {
  4.                 if (input.SHIFT.isPressed()) {
  5.                     text = text + "Q";
  6.                     System.out.println(text);
  7.                     inputKey++;
  8.                 } else {
  9.                     text = text + "q";
  10.                     System.out.println(text);
  11.                     inputKey++;
  12.                 }
  13.                
  14.             }
  15.         case 1:
  16.             if (inputKey == 0) {
  17.                 if (input.SHIFT.isPressed()) {
  18.                     text = text + "W";
  19.                     System.out.println(text);
  20.                     inputKey++;
  21.                 } else {
  22.                     text = text + "w";
  23.                     System.out.println(text);
  24.                     inputKey++;
  25.                 }
  26.             }
  27.         case 2:
  28.             if (inputKey == 0) {
  29.                 if (input.SHIFT.isPressed()) {
  30.                     text = text + "E";
  31.                     System.out.println(text);
  32.                     inputKey++;
  33.                 } else {
  34.                     text = text + "e";
  35.                     System.out.println(text);
  36.                     inputKey++;
  37.                 }
  38.             }
  39.         case 3:
  40.             if (inputKey == 0) {
  41.                 if (input.SHIFT.isPressed()) {
  42.                     text = text + "R";
  43.                     System.out.println(text);
  44.                     inputKey++;
  45.                 } else {
  46.                     text = text + "r";
  47.                     System.out.println(text);
  48.                     inputKey++;
  49.                 }
  50.             }
  51.         case 4:
  52.             if (inputKey == 0) {
  53.                 if (input.SHIFT.isPressed()) {
  54.                     text = text + "T";
  55.                     System.out.println(text);
  56.                     inputKey++;
  57.                 } else {
  58.                     text = text + "t";
  59.                     System.out.println(text);
  60.                     inputKey++;
  61.                 }
  62.             }
  63.         case 5:
  64.             if (inputKey == 0) {
  65.                 if (input.SHIFT.isPressed()) {
  66.                     text = text + "Y";
  67.                     System.out.println(text);
  68.                     inputKey++;
  69.                 } else {
  70.                     text = text + "y";
  71.                     System.out.println(text);
  72.                     inputKey++;
  73.                 }
  74.             }
  75.         case 6:
  76.             if (inputKey == 0) {
  77.                 if (input.SHIFT.isPressed()) {
  78.                     text = text + "U";
  79.                     System.out.println(text);
  80.                     inputKey++;
  81.                 } else {
  82.                     text = text + "u";
  83.                     System.out.println(text);
  84.                     inputKey++;
  85.                 }
  86.             }
  87.         case 7:
  88.             if (inputKey == 0) {
  89.                 if (input.SHIFT.isPressed()) {
  90.                     text = text + "I";
  91.                     System.out.println(text);
  92.                     inputKey++;
  93.                 } else {
  94.                     text = text + "i";
  95.                     System.out.println(text);
  96.                     inputKey++;
  97.                 }
  98.             }
  99.         case 8:
  100.             if (inputKey == 0) {
  101.                 if (input.SHIFT.isPressed()) {
  102.                     text = text + "O";
  103.                     System.out.println(text);
  104.                     inputKey++;
  105.                 } else {
  106.                     text = text + "o";
  107.                     System.out.println(text);
  108.                     inputKey++;
  109.                 }
  110.             }
  111.         case 9:
  112.             if (inputKey == 0) {
  113.                 if (input.SHIFT.isPressed()) {
  114.                     text = text + "P";
  115.                     System.out.println(text);
  116.                     inputKey++;
  117.                 } else {
  118.                     text = text + "p";
  119.                     System.out.println(text);
  120.                     inputKey++;
  121.                 }
  122.             }
  123.         case 10:
  124.             if (inputKey == 0) {
  125.                 if (input.SHIFT.isPressed()) {
  126.                     text = text + "A";
  127.                     System.out.println(text);
  128.                     inputKey++;
  129.                 } else {
  130.                     text = text + "a";
  131.                     System.out.println(text);
  132.                     inputKey++;
  133.                 }
  134.             }
  135.         case 11:
  136.             if (inputKey == 0) {
  137.                 if (input.SHIFT.isPressed()) {
  138.                     text = text + "S";
  139.                     System.out.println(text);
  140.                     inputKey++;
  141.                 } else {
  142.                     text = text + "s";
  143.                     System.out.println(text);
  144.                     inputKey++;
  145.                 }
  146.             }
  147.         case 12:
  148.             if (inputKey == 0) {
  149.                 if (input.SHIFT.isPressed()) {
  150.                     text = text + "D";
  151.                     System.out.println(text);
  152.                     inputKey++;
  153.                 } else {
  154.                     text = text + "d";
  155.                     System.out.println(text);
  156.                     inputKey++;
  157.                 }
  158.             }
  159.         case 13:
  160.             if (inputKey == 0) {
  161.                 if (input.SHIFT.isPressed()) {
  162.                     text = text + "F";
  163.                     System.out.println(text);
  164.                     inputKey++;
  165.                 } else {
  166.                     text = text + "f";
  167.                     System.out.println(text);
  168.                     inputKey++;
  169.                 }
  170.             }
  171.         case 14:
  172.             if (inputKey == 0) {
  173.                 if (input.SHIFT.isPressed()) {
  174.                     text = text + "G";
  175.                     System.out.println(text);
  176.                     inputKey++;
  177.                 } else {
  178.                     text = text + "g";
  179.                     System.out.println(text);
  180.                     inputKey++;
  181.                 }
  182.             }
  183.         case 15:
  184.             if (inputKey == 0) {
  185.                 if (input.SHIFT.isPressed()) {
  186.                     text = text + "H";
  187.                     System.out.println(text);
  188.                     inputKey++;
  189.                 } else {
  190.                     text = text + "h";
  191.                     System.out.println(text);
  192.                     inputKey++;
  193.                 }
  194.             }
  195.         case 16:
  196.             if (inputKey == 0) {
  197.                 if (input.SHIFT.isPressed()) {
  198.                     text = text + "J";
  199.                     System.out.println(text);
  200.                     inputKey++;
  201.                 } else {
  202.                     text = text + "J";
  203.                     System.out.println(text);
  204.                     inputKey++;
  205.                 }
  206.             }
  207.         case 17:
  208.             if (inputKey == 0) {
  209.                 if (input.SHIFT.isPressed()) {
  210.                     text = text + "K";
  211.                     System.out.println(text);
  212.                     inputKey++;
  213.                 } else {
  214.                     text = text + "k";
  215.                     System.out.println(text);
  216.                     inputKey++;
  217.                 }
  218.             }
  219.         case 18:
  220.             if (inputKey == 0) {
  221.                 if (input.SHIFT.isPressed()) {
  222.                     text = text + "L";
  223.                     System.out.println(text);
  224.                     inputKey++;
  225.                 } else {
  226.                     text = text + "l";
  227.                     System.out.println(text);
  228.                     inputKey++;
  229.                 }
  230.             }
  231.         case 19:
  232.             if (inputKey == 0) {
  233.                 if (input.SHIFT.isPressed()) {
  234.                     text = text + "Z";
  235.                     System.out.println(text);
  236.                     inputKey++;
  237.                 } else {
  238.                     text = text + "z";
  239.                     System.out.println(text);
  240.                     inputKey++;
  241.                 }
  242.             }
  243.         case 20:
  244.             if (inputKey == 0) {
  245.                 if (input.SHIFT.isPressed()) {
  246.                     text = text + "X";
  247.                     System.out.println(text);
  248.                     inputKey++;
  249.                 } else {
  250.                     text = text + "x";
  251.                     System.out.println(text);
  252.                     inputKey++;
  253.                 }
  254.             }
  255.         case 21:
  256.             if (inputKey == 0) {
  257.                 if (input.SHIFT.isPressed()) {
  258.                     text = text + "C";
  259.                     System.out.println(text);
  260.                     inputKey++;
  261.                 } else {
  262.                     text = text + "c";
  263.                     System.out.println(text);
  264.                     inputKey++;
  265.                 }
  266.             }
  267.         case 22:
  268.             if (inputKey == 0) {
  269.                 if (input.SHIFT.isPressed()) {
  270.                     text = text + "V";
  271.                     System.out.println(text);
  272.                     inputKey++;
  273.                 } else {
  274.                     text = text + "v";
  275.                     System.out.println(text);
  276.                     inputKey++;
  277.                 }
  278.             }
  279.         case 23:
  280.             if (inputKey == 0) {
  281.                 if (input.SHIFT.isPressed()) {
  282.                     text = text + "B";
  283.                     System.out.println(text);
  284.                     inputKey++;
  285.                 } else {
  286.                     text = text + "b";
  287.                     System.out.println(text);
  288.                     inputKey++;
  289.                 }
  290.             }
  291.         case 24:
  292.             if (inputKey == 0) {
  293.                 if (input.SHIFT.isPressed()) {
  294.                     text = text + "N";
  295.                     System.out.println(text);
  296.                     inputKey++;
  297.                 } else {
  298.                     text = text + "n";
  299.                     System.out.println(text);
  300.                     inputKey++;
  301.                 }
  302.             }
  303.         case 25:
  304.             if (inputKey == 0) {
  305.                 if (input.SHIFT.isPressed()) {
  306.                     text = text + "M";
  307.                     System.out.println(text);
  308.                     inputKey++;
  309.                 } else {
  310.                     text = text + "m";
  311.                     System.out.println(text);
  312.                     inputKey++;
  313.                 }
  314.             }
  315.         case 26:
  316.             if (inputKey == 0) {
  317.                  
  318.                 text = text + " ";
  319.                 System.out.println(text);
  320.                 inputKey++;
  321.             }
  322.         case 27:
  323.             if (inputKey == 0) {
  324.                 if (text.length() == 0) {
  325.                     return;
  326.                 } else {
  327.                     text = text.substring(0, text.length()-1);
  328.                     System.out.println(text);
  329.                     inputKey++;
  330.                 }
  331.             }
  332.         case 28:
  333.             if (inputKey == 0) {
  334.                 text = text + "1";
  335.                 System.out.println(text);
  336.                 inputKey++;
  337.             }
  338.         case 29:
  339.             if (inputKey == 0) {
  340.                 text = text + "2";
  341.                 System.out.println(text);
  342.                 inputKey++;
  343.             }
  344.         case 30:
  345.             if (inputKey == 0) {
  346.                 text = text + "3";
  347.                 System.out.println(text);
  348.                 inputKey++;
  349.             }
  350.         case 31:
  351.             if (inputKey == 0) {
  352.                 text = text + "4";
  353.                 System.out.println(text);
  354.                 inputKey++;
  355.             }
  356.         case 32:
  357.             if (inputKey == 0) {
  358.                 text = text + "5";
  359.                 System.out.println(text);
  360.                 inputKey++;
  361.             }
  362.         case 33:
  363.             if (inputKey == 0) {
  364.                 text = text + "6";
  365.                 System.out.println(text);
  366.                 inputKey++;
  367.             }
  368.         case 34:
  369.             if (inputKey == 0) {
  370.                 text = text + "7";
  371.                 System.out.println(text);
  372.                 inputKey++;
  373.             }
  374.         case 35:
  375.             if (inputKey == 0) {
  376.                 text = text + "8";
  377.                 System.out.println(text);
  378.                 inputKey++;
  379.             }
  380.         case 36:
  381.             if (inputKey == 0) {
  382.                 text = text + "9";
  383.                 System.out.println(text);
  384.                 inputKey++;
  385.             }
  386.         case 37:
  387.             if (inputKey == 0) {
  388.                 text = text + "0";
  389.                 System.out.println(text);
  390.                 inputKey++;
  391.             }
  392.        
  393.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement