當前位置: 首頁>>代碼示例>>Java>>正文


Java MouseButton.MIDDLE屬性代碼示例

本文整理匯總了Java中javafx.scene.input.MouseButton.MIDDLE屬性的典型用法代碼示例。如果您正苦於以下問題:Java MouseButton.MIDDLE屬性的具體用法?Java MouseButton.MIDDLE怎麽用?Java MouseButton.MIDDLE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javafx.scene.input.MouseButton的用法示例。


在下文中一共展示了MouseButton.MIDDLE屬性的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMouseButton

public MouseButton getMouseButton() {
    if (button == 0) {
        return MouseButton.PRIMARY;
    } else if (button == 1) {
        return MouseButton.MIDDLE;
    } else {
        return MouseButton.SECONDARY;
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:9,代碼來源:IDevice.java

示例2: storeMouseDown

private void storeMouseDown(MouseButton button) {
    if (button == MouseButton.PRIMARY) {
        button1Pressed = true;
    }
    if (button == MouseButton.MIDDLE) {
        button2Pressed = true;
    }
    if (button == MouseButton.SECONDARY) {
        button3Pressed = true;
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:11,代碼來源:FXEventQueueDevice.java

示例3: storeMouseUp

private void storeMouseUp(MouseButton button) {
    if (button == MouseButton.PRIMARY) {
        button1Pressed = false;
    }
    if (button == MouseButton.MIDDLE) {
        button2Pressed = false;
    }
    if (button == MouseButton.SECONDARY) {
        button3Pressed = false;
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:11,代碼來源:FXEventQueueDevice.java

示例4: getButtons

public MouseButton getButtons() {
    if (button1Pressed) {
        return MouseButton.PRIMARY;
    }
    if (button2Pressed) {
        return MouseButton.MIDDLE;
    }
    if (button3Pressed) {
        return MouseButton.SECONDARY;
    }
    return MouseButton.NONE;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:12,代碼來源:FXEventQueueDevice.java

示例5: getButtonMask

public MouseButton getButtonMask() {
    if (button1Pressed) {
        return MouseButton.PRIMARY;
    }
    if (button2Pressed) {
        return MouseButton.MIDDLE;
    }
    if (button3Pressed) {
        return MouseButton.SECONDARY;
    }
    return MouseButton.NONE;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:12,代碼來源:FXEventQueueDevice.java

示例6: getModifiersExText

protected static String getModifiersExText(MouseEvent event) {
    StringBuffer buf = new StringBuffer();
    if (event.isMetaDown()) {
        buf.append("Meta");
        buf.append("+");
    }
    if (event.isControlDown()) {
        buf.append("Ctrl");
        buf.append("+");
    }
    if (event.isAltDown()) {
        buf.append("Alt");
        buf.append("+");
    }
    if (event.isShiftDown()) {
        buf.append("Shift");
        buf.append("+");
    }
    if (event.getButton() == MouseButton.PRIMARY) {
        buf.append("Button1");
        buf.append("+");
    }
    if (event.getButton() == MouseButton.MIDDLE) {
        buf.append("Button2");
        buf.append("+");
    }
    if (event.getButton() == MouseButton.SECONDARY) {
        buf.append("Button3");
        buf.append("+");
    }
    return buf.toString();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:32,代碼來源:EventQueueDeviceTest.java

示例7: notifyClickEvent

/**
 * Use this method to process a click event and send a special GUI event by the means of the message system.
 * @param event MouseEvent. A click event
 */
void notifyClickEvent(MouseEvent event) {
    if (!event.isStillSincePress()) {
        return;
    }

    Map<String, Object> m = new HashMap<>();
    m.put("screenX", event.getScreenX());
    m.put("screenY", event.getScreenY());
    m.put("nodeX", event.getScreenX() - sender.getLayoutX());
    m.put("nodeY", event.getScreenY() - sender.getLayoutY());
    m.put("nodeWidth", sender.getLayoutBounds().getWidth());
    m.put("nodeHeight", sender.getLayoutBounds().getHeight());

    StringBuilder eventMessage = new StringBuilder("gui-events:").append(senderName).append("-");
    if (event.getButton() == MouseButton.PRIMARY) {
        if (event.getClickCount() == 2) {
            eventMessage.append("double");
        } else {
            eventMessage.append("left");
        }
    } else if (event.getButton() == MouseButton.SECONDARY) {
        eventMessage.append("right");
    } else if (event.getButton() == MouseButton.MIDDLE) {
        eventMessage.append("middle");
    } else {
        return;
    }
    eventMessage.append("-click");

    Main.getInstance().getPluginProxy().sendMessage(eventMessage.toString(), m);
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:35,代碼來源:MouseEventNotificator.java


注:本文中的javafx.scene.input.MouseButton.MIDDLE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。