Exemple #1
0
  public void update(double dt) {
    // Select when clicked
    if (isHovered()) {
      if (Input.isMousePressed()) {
        select();
      }
    }

    if (Input.isPressed(KeyEvent.VK_PASTE) && isSelected()) {
      paste();
    }

    // Determine color based on selected or not
    int regular = 180;

    if (isSelected()) setColor(Color.white);
    else setColor(new Color(regular, regular, regular));
  }
Exemple #2
0
 /**
  * Set this field to be the selected field. Will intercept all user keystrokes until deselected.
  */
 public void select() {
   selectedField = this;
   Input.interceptTextInput(
       new Observer() {
         public void notify(Object arg) {
           Character c = (Character) arg;
           addChar(c);
         }
       });
 }
Exemple #3
0
 /** Unselect this field. Keystrokes will be normal again */
 public void deselect() {
   selectedField = null;
   Input.releaseInterceptTextInput();
 }