src/main/java/dev/lambdaurora/spruceui/navigation/NavigationDirection.java
public static Optional<NavigationDirection> fromKey(int keyCode, boolean shift) {
        if (shift && keyCode != GLFW.GLFW_KEY_TAB)
            return Optional.empty();
        switch (keyCode) {
            case GLFW.GLFW_KEY_LEFT:
                return Optional.of(LEFT);
            case GLFW.GLFW_KEY_RIGHT:
                return Optional.of(RIGHT);
            case GLFW.GLFW_KEY_UP:
                return Optional.of(UP);
            case GLFW.GLFW_KEY_TAB:
                if (shift)
                    return Optional.of(UP);
            case GLFW.GLFW_KEY_DOWN:
                return Optional.of(DOWN);
            default:
                return Optional.empty();
        }
    }
/**
     * Returns a navigation direction from a key.
     *
     * @param keyCode the key
     * @param shift true if the shift key is pressed, else false
     * @return the direction if associated to the specified key, else empty
     */
Returns a navigation direction from a key.
@param keyCode the key
@param shift true if the shift key is pressed, else false
@return the direction if associated to the specified key, else empty
Returns a navigation direction from a key . @param keyCode the key @param shift true if the shift key is pressed else false @return the direction if associated to the specified key else empty
public static Optional<NavigationDirection> fromKey(int keyCode, boolean shift) {
        if (shift && keyCode != GLFW.GLFW_KEY_TAB)
            return Optional.empty();
        switch (keyCode) {
            case GLFW.GLFW_KEY_LEFT:
                return Optional.of(LEFT);
            case GLFW.GLFW_KEY_RIGHT:
                return Optional.of(RIGHT);
            case GLFW.GLFW_KEY_UP:
                return Optional.of(UP);
            case GLFW.GLFW_KEY_TAB:
                if (shift)
                    return Optional.of(UP);
            case GLFW.GLFW_KEY_DOWN:
                return Optional.of(DOWN);
            default:
                return Optional.empty();
        }
    }
public static Optional < NavigationDirection > fromKey ( int keyCode , boolean shift ) { if ( shift && keyCode != GLFW . GLFW_KEY_TAB ) return Optional . empty ( ) ; switch ( keyCode ) { case GLFW . GLFW_KEY_LEFT : return Optional . of ( LEFT ) ; case GLFW . GLFW_KEY_RIGHT : return Optional . of ( RIGHT ) ; case GLFW . GLFW_KEY_UP : return Optional . of ( UP ) ; case GLFW . GLFW_KEY_TAB : if ( shift ) return Optional . of ( UP ) ; case GLFW . GLFW_KEY_DOWN : return Optional . of ( DOWN ) ; default : return Optional . empty ( ) ; } }
Returns a navigation direction from a key.
Returns a navigation direction from a key .