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


Java MouseButtonEvent.getButtonIndex方法代码示例

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


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

示例1: onMouseButtonEvent

import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
@Override
public void onMouseButtonEvent(MouseButtonEvent evt) {
	if (evt.getButtonIndex() == 0) {
		BaseElement mouseFocusElement = screen.getMouseFocusElement();
		if (mouseFocusElement != null) {
			elementTree.setSelectedRowObjects(Arrays.asList(mouseFocusElement));
			highlightSelection();
			for (TableRow r : elementTree.getSelectedRows()) {
				elementTree.scrollToRow(r.getRowIndex());
				break;
			}
		}
	}
	endPick();
	evt.setConsumed();
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:17,代码来源:GUIExplorerAppState.java

示例2: onMouseButtonEventQueued

import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
private void onMouseButtonEventQueued(MouseButtonEvent evt, NiftyInputConsumer nic) {
    buttonIndex = evt.getButtonIndex();
    pressed = evt.isPressed();

    if (nic.processMouseEvent(x, y, 0, buttonIndex, pressed)){
        evt.setConsumed();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:InputSystemJme.java

示例3: MouseUIButtonEvent

import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
public MouseUIButtonEvent(MouseButtonEvent originator, E element, int modifiers) {
	this(originator.getButtonIndex(), originator.isPressed(), originator.getX(), originator.getY(),
			(int) (originator.getX() - (element == null ? 00 : element.getAbsoluteX())),
			(int) (originator.getY() - (element == null ? 00 : element.getAbsoluteY())),
			element == null ? 1 : element.getScreen().getClickCount(), modifiers, element);

	this.originator = originator;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:9,代码来源:MouseUIButtonEvent.java

示例4: onMouseButtonEvent

import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
@Override
public void onMouseButtonEvent(MouseButtonEvent evt) {
    if (currentInputName == null || currentKeyButton == null) {
        return;
    }
    inputManager.removeRawInputListener(this);

    final MouseButtonTrigger trigger =
            new MouseButtonTrigger(evt.getButtonIndex());
    inputManager.deleteMapping(currentInputName);
    inputManager.addMapping(currentInputName, trigger);
    inputSettings.saveInput(currentInputName, trigger);

    try {
        app.getContext().getSettings().save(ClientMain.PREFERENCES_KEY);
    } catch (BackingStoreException ex) {
        Logger.getLogger(KeySetter.class.getName())
                .log(Level.WARNING, "Failed to save settings", ex);
    }

    app.enqueue(() -> {
        if (trigger.getMouseButton() == 0) {
            currentKeyButton.setText("Mouse Left");
        } else if (trigger.getMouseButton() == 1) {
            currentKeyButton.setText("Mouse Right");
        } else if (trigger.getMouseButton() == 2) {
            currentKeyButton.setText("Mouse Middle");
        } else {
            currentKeyButton.setText("Mouse Strange");
        }
        
        currentKeyButton = null;
        currentInputName = null;
        
        return null;
    });

    evt.setConsumed();
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:40,代码来源:KeySetter.java

示例5: onMouseButtonEventQueued

import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
private void onMouseButtonEventQueued(MouseButtonEvent evt, NiftyInputConsumer nic) {
    boolean wasPressed = pressed;
    boolean forwardToNifty = true;
    
    buttonIndex = evt.getButtonIndex();
    pressed = evt.isPressed();
    
    // Mouse button raised. End dragging
    if (wasPressed && !pressed){
        if (!niftyOwnsDragging){
            forwardToNifty = false;
        }
        isDragging = false;
        niftyOwnsDragging = false;
    }

    boolean consumed = false;
    if (forwardToNifty){
        consumed = nic.processMouseEvent(x, y, 0, buttonIndex, pressed);
        if (consumed){
            evt.setConsumed();
        }
    }
    
    // Mouse button pressed. Begin dragging
    if (!wasPressed && pressed){
        isDragging = true;
        niftyOwnsDragging = consumed;
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:31,代码来源:InputSystemJme.java

示例6: onMouseButtonEvent

import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
public void onMouseButtonEvent(MouseButtonEvent evt) {
    if (inputManager.isCursorVisible() && evt.getButtonIndex() >= 0 || evt.getButtonIndex() <= 2){
        inputQueue.add(evt);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:6,代码来源:InputSystemJme.java

示例7: s3dOnMouseButtonEvent

import com.jme3.input.event.MouseButtonEvent; //导入方法依赖的package包/类
private void s3dOnMouseButtonEvent(MouseButtonEvent evt) {
	float x = Screen.isAndroid() ? touchXY.x : mouseXY.x;
	float y = Screen.isAndroid() ? touchXY.y : mouseXY.y;
	eventNode = getEventNode(x, y);
	if (eventNode != null) {
		if (evt.isPressed()) {
			switch (evt.getButtonIndex()) {
				case 0:
					if (eventNode instanceof MouseButtonListener) {
						((MouseButtonListener)eventNode).onMouseLeftPressed(evt);
					}
					break;
				case 1:
					if (eventNode instanceof MouseButtonListener) {
						((MouseButtonListener)eventNode).onMouseRightPressed(evt);
					}
					break;
				case 2:
					if (eventNode instanceof MouseWheelListener) {
						((MouseWheelListener)eventNode).onMouseWheelPressed(evt);
					}
					break;
			}
		} else if (evt.isReleased()) {
			switch (evt.getButtonIndex()) {
				case 0:
					if (eventNode instanceof MouseButtonListener) {
						((MouseButtonListener)eventNode).onMouseLeftReleased(evt);
					}
					break;
				case 1:
					if (eventNode instanceof MouseButtonListener) {
						((MouseButtonListener)eventNode).onMouseRightReleased(evt);
					}
					break;
				case 2:
					if (eventNode instanceof MouseWheelListener) {
						((MouseWheelListener)eventNode).onMouseWheelReleased(evt);
					}
					break;
			}
			eventNode = null;
		}
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:46,代码来源:Screen.java


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