public PokemonMenu(Character c, JFrame frame, boolean inBattle, boolean hasCancel) { frame.addKeyListener(new Key()); this.frame = frame; this.inBattle = inBattle; this.hasCancel = hasCancel; character = c; selected = 0; txt = new TextBox( frame, "Choose a Pokemon.", 0, Window.HEIGHT - 80, 500, 80, false, false, Style.POKEMON_MENU); switchingTxt = new TextBox( frame, "Switch with...", 0, Window.HEIGHT - 80, 500, 80, false, false, Style.POKEMON_MENU); txt.removeKeyListener(); switchingTxt.removeKeyListener(); over = false; switching = false; switchIndex = -1; refreshZ = false; totalButtons = hasCancel ? 7 : 6; for (Pokemon p : c.currentPokemon()) if (p == null) totalButtons--; }