@Override protected void keyTyped(final char key, final int keyID) { // Did they press the escape key? if (keyID == Keyboard.KEY_ESCAPE) { // Close the screen. this.mc.thePlayer.closeScreen(); return; } // Prevent only spaces if ((key == ' ') && (this.searchField.getText().length() == 0)) { return; } if (this.searchField.textboxKeyTyped(key, keyID)) { // Get the search query String newSearch = this.searchField.getText().trim().toLowerCase(); // Has the query changed? if (!newSearch.equals(this.itemRepo.searchString)) { // Set the search string this.itemRepo.searchString = newSearch; // Repo needs update this.viewNeedsUpdate = true; } } else { super.keyTyped(key, keyID); } }