Package Green

Class InputKey

java.lang.Object
Green.InputKey

public class InputKey extends Object
A class for storing a key input for (primarily internal) use. It stores both the char key and the int keyCode of the input.
Author:
Zacchary Dempsey-Plante
  • Constructor Summary

    Constructors
    Constructor
    Description
    InputKey​(char key, int keyCode)
    Creates the storage class representing the pressed key.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals​(Object obj)
     
    char
    Retrieves the char representation of the key that was pressed (or PConstants.CODED if the key doesn't have one)
    int
    Retrieves the keycode of the key that was pressed.
    int
     
     

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • InputKey

      public InputKey(char key, int keyCode)
      Creates the storage class representing the pressed key.
      Parameters:
      key - The char representation of the pressed key.
      keyCode - The keyCode of the pressed key.
  • Method Details

    • getKey

      public char getKey()
      Retrieves the char representation of the key that was pressed (or PConstants.CODED if the key doesn't have one)
      Returns:
      The char representation of the key that was pressed (or PConstants.CODED if the key doesn't have one)
    • getKeyCode

      public int getKeyCode()
      Retrieves the keycode of the key that was pressed.
      Returns:
      The keycode of the key that was pressed.
      See Also:
      Java KeyEvent reference
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object