Java Code Examples for com.jme3.input.MouseInput#BUTTON_MIDDLE

The following examples show how to use com.jme3.input.MouseInput#BUTTON_MIDDLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AwtMouseInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private int getJMEButtonIndex(MouseEvent awtEvt) {
    int index;
    switch (awtEvt.getButton()) {
        default:
        case MouseEvent.BUTTON1: //left
            index = MouseInput.BUTTON_LEFT;
            break;
        case MouseEvent.BUTTON2: //middle
            index = MouseInput.BUTTON_MIDDLE;
            break;
        case MouseEvent.BUTTON3: //right
            index = MouseInput.BUTTON_RIGHT;
            break;
    }
    return index;
}
 
Example 2
Source File: AwtMouseInput.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private int getJMEButtonIndex( MouseEvent arg0 ) {
    int index;
    switch (arg0.getButton()) {
        default:
        case MouseEvent.BUTTON1: //left
            index = MouseInput.BUTTON_LEFT;
            break;
        case MouseEvent.BUTTON2: //middle
            index = MouseInput.BUTTON_MIDDLE;
            break;
        case MouseEvent.BUTTON3: //right
            index = MouseInput.BUTTON_RIGHT;
            break;
    }
    return index;
}
 
Example 3
Source File: StyleDebugMouseListener.java    From Lemur with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void click( MouseButtonEvent event, Spatial target, Spatial capture ) {
    if( event.getButtonIndex() == MouseInput.BUTTON_MIDDLE ) {
        if( target instanceof Panel ) {
            Panel p = (Panel)target;
            System.out.println( "gui element:" + p
                                + "  elementId:" + p.getElementId()
                                + "  style:" + p.getStyle() );
        }
    }
}
 
Example 4
Source File: GlfwMouseInputVR.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Simply converts the GLFW button code to a JME button code. If there is no
 * match it just returns the GLFW button code. Bear in mind GLFW supports 8
 * different mouse buttons.
 *
 * @param glfwButton the raw GLFW button index.
 * @return the mapped {@link MouseInput} button id.
 */
private int convertButton(final int glfwButton) {
    switch (glfwButton) {
        case GLFW_MOUSE_BUTTON_LEFT:
        return MouseInput.BUTTON_LEFT;
        case GLFW_MOUSE_BUTTON_MIDDLE:
        return MouseInput.BUTTON_MIDDLE;
        case GLFW_MOUSE_BUTTON_RIGHT:
        return MouseInput.BUTTON_RIGHT;
        default:
            return glfwButton;
    }
}
 
Example 5
Source File: GlfwMouseInput.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Simply converts the GLFW button code to a JME button code. If there is no
 * match it just returns the GLFW button code. Bear in mind GLFW supports 8
 * different mouse buttons.
 *
 * @param glfwButton the raw GLFW button index.
 * @return the mapped {@link MouseInput} button id.
 */
private int convertButton(final int glfwButton) {
    switch (glfwButton) {
        case GLFW_MOUSE_BUTTON_LEFT:
            return MouseInput.BUTTON_LEFT;
        case GLFW_MOUSE_BUTTON_MIDDLE:
            return MouseInput.BUTTON_MIDDLE;
        case GLFW_MOUSE_BUTTON_RIGHT:
            return MouseInput.BUTTON_RIGHT;
        default:
            return glfwButton;
    }
}