当前位置: 首页>>代码示例>>Java>>正文


Java SWT.BUTTON2属性代码示例

本文整理汇总了Java中org.eclipse.swt.SWT.BUTTON2属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.BUTTON2属性的具体用法?Java SWT.BUTTON2怎么用?Java SWT.BUTTON2使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.swt.SWT的用法示例。


在下文中一共展示了SWT.BUTTON2属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendMouseEventToFX

private void sendMouseEventToFX(MouseEvent me, int embedMouseType) {
    if (scenePeer == null) {
        return;
    }

    Point los = toDisplay(me.x, me.y);
    boolean primaryBtnDown = (me.stateMask & SWT.BUTTON1) != 0;
    boolean middleBtnDown = (me.stateMask & SWT.BUTTON2) != 0;
    boolean secondaryBtnDown = (me.stateMask & SWT.BUTTON3) != 0;
    boolean shift = (me.stateMask & SWT.SHIFT) != 0;
    boolean control = (me.stateMask & SWT.CONTROL) != 0;
    boolean alt = (me.stateMask & SWT.ALT) != 0;
    boolean meta = (me.stateMask & SWT.COMMAND) != 0;
    int button = me.button;
    switch (embedMouseType) {
        case AbstractEvents.MOUSEEVENT_PRESSED:
            primaryBtnDown |= me.button == 1;
            middleBtnDown |= me.button == 2;
            secondaryBtnDown |= me.button == 3;
            break;
        case AbstractEvents.MOUSEEVENT_RELEASED:
            primaryBtnDown &= me.button != 1;
            middleBtnDown &= me.button != 2;
            secondaryBtnDown &= me.button != 3;
            break;
        case AbstractEvents.MOUSEEVENT_CLICKED:
            // Don't send click events to FX, as they are generated in Scene
            return;

        case AbstractEvents.MOUSEEVENT_MOVED:
        case AbstractEvents.MOUSEEVENT_DRAGGED:
        case AbstractEvents.MOUSEEVENT_ENTERED:
        case AbstractEvents.MOUSEEVENT_EXITED:
            // If this event was the result of mouse movement and has no
            // button associated with it, then we look at the state to
            // determine which button to report
            if (button == 0) {
                if ((me.stateMask & SWT.BUTTON1) != 0) {
                    button = 1;
                } else if ((me.stateMask & SWT.BUTTON2) != 0) {
                    button = 2;
                } else if ((me.stateMask & SWT.BUTTON3) != 0) {
                    button = 3;
                }
            }
            break;

        default:
            break;
    }

    scenePeer.mouseEvent(
            embedMouseType,
            SWTEvents.mouseButtonToEmbedMouseButton(button, me.stateMask),
            primaryBtnDown, middleBtnDown, secondaryBtnDown,
            me.x, me.y,
            los.x, los.y,
            shift, control, alt, meta,
            SWTEvents.getWheelRotation(me, embedMouseType),
            false);  // RT-32990: popup trigger not implemented
}
 
开发者ID:TRUEJASONFANS,项目名称:JavaFX-FrameRateMeter,代码行数:61,代码来源:OldFXCanvas.java


注:本文中的org.eclipse.swt.SWT.BUTTON2属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。