@Override
    protected int updateOptions() {
        if (Keyboard.next() && Keyboard.getEventKeyState()) {
            int key = Keyboard.getEventKey();
            if (key == Keyboard.KEY_RETURN) {
                return selectedIndex;
            } else if (key == Keyboard.KEY_UP) {
                selectedIndex = ((selectedIndex + MenuOptions.size()) - 1) % MenuOptions.size();
            } else if (key == Keyboard.KEY_DOWN) {
                selectedIndex = (selectedIndex + 1) % MenuOptions.size();
            } else if (key == Keyboard.KEY_BACK) {
                removeChar();
            } else { // If not navigating the menu, put characters into ipBuffer
                char c = Keyboard.getEventCharacter();
                if (Character.isDigit(c) || c == '.')
                    addChar(c);
            }
        }
        return -1;
    }