public void mouseReleased(MouseEvent e) { if (graphwar.getGameData().getGameState() == Constants.NONE) { int roomNum = e.getY() / entryHeight; if (roomNum < graphwar.getGlobalClient().getRooms().size()) { Room room = graphwar.getGlobalClient().getRooms().get(roomNum); ((GlobalScreen) graphwar.getUI().getScreen(Constants.GLOBAL_ROOM_SCREEN)) .showMessage("Connecting..."); try { graphwar.joinGame(room.getIp(), room.getPort()); graphwar.getGameData().addPlayer(graphwar.getGlobalClient().getLocalPlayerName()); graphwar.getUI().setScreen(Constants.PRE_GAME_SCREEN); } catch (IOException e1) { ((GlobalScreen) graphwar.getUI().getScreen(Constants.GLOBAL_ROOM_SCREEN)) .showMessage("Could not connect."); graphwar.getGameData().disconnect(); e1.printStackTrace(); } } } }