• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MouseButtonEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createDraggable

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
private void createDraggable() {
    if (inventoryItem.getItem() != null) {
        addChild(draggable = new InventoryItemDraggable(dragContext, screen, inventoryAndEquipment, inventoryItem) {
            @Override
            protected boolean doOnDragEnd(MouseButtonEvent mbe, Element elmnt) {
                try {
                    return doEndDraggableDrag(mbe, elmnt);
                } finally {
                    screen.updateZOrder(LUtil.getRootElement(this));
                }
            }

            @Override
            protected boolean doOnClick(MouseButtonEvent evt) {
                // Does nothing at the moment
                return false;
            }
        });
    }
}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:21,代码来源:InventoryItemDroppable.java


示例2: doOnDragEnd

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
@Override
public boolean doOnDragEnd(MouseButtonEvent mbe, Element elmnt) {
    LOG.fine(String.format("Finished drag of %s on to %s", toString(), elmnt));
    if (elmnt != null && elmnt instanceof InventoryItemDroppable && !elmnt.equals(getParent()) && inventoryAndEquipment.getFreeSlots() > 0) {
        try {
            InventoryItemDroppable droppable = (InventoryItemDroppable) elmnt;
            inventoryAndEquipment.deequip(droppable.getInventoryItem().getSlot(), bagItem.getSlot());
            return true;
        } catch (NetworkException ex) {
            LOG.log(Level.SEVERE, " Failed to de-equip.", ex);
        } finally {
            screen.updateZOrder(LUtil.getRootElement(this));
        }
    }
    return false;
}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:17,代码来源:ContainerDraggable.java


示例3: actionPerformed

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
@Override
public void actionPerformed(ActionData data) {
	Screen screen = data.getApp().getScreen();
	ZMenu subMenu = new ZMenu(screen) {
	};
	CheckBox snapToFloor = new CheckBox(screen) {
		@Override
		public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
			Config.get().putBoolean(Config.BUILD_SNAP_TO_FLOOR, toggled);
		}
	};
	snapToFloor.setIsCheckedNoCallback(Config.get().getBoolean(Config.BUILD_SNAP_TO_FLOOR, Config.BUILD_SNAP_TO_FLOOR_DEFAULT));
	subMenu.addMenuItem("Snap to floor", snapToFloor, null);
	addCategory(subMenu, screen, "Location Grid Snap", Config.BUILD_LOCATION_SNAP, Config.BUILD_LOCATION_SNAP_DEFAULT);
	addCategory(subMenu, screen, "Rotation Grid Snap", Config.BUILD_EULER_ROTATION_SNAP,
			Config.BUILD_EULER_ROTATION_SNAP_DEFAULT);
	addCategory(subMenu, screen, "Scale Grid Snap", Config.BUILD_SCALE_SNAP, Config.BUILD_SCALE_SNAP_DEFAULT);

	screen.addElement(subMenu);
	subMenu.showMenu(null, data.getX(), data.getY() - subMenu.getHeight());
}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:22,代码来源:GridTool.java


示例4: armourGroup

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
private Container armourGroup(final int index, final Form form, List<Item> items, final Slot slot) {
	Container heads = new Container(screen);
	heads.setLayoutManager(new MigLayout(screen, "", "push[][][][][]push"));
	for (final Item item : items) {
		if (item != null) {
			UIButton button = new UIButton(screen) {
				@Override
				public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
					start.getInitialEquipment().set(index, item);
					start.getSpatial().setAppearance(slot, item.getAppearance());
					start.getSpatial().reload();
				}
			};
			button.setButtonIcon(32, 32, String.format("Icons/%s", item.getIcon1()));
			button.setToolTipText(item.getDisplayName());
			heads.addChild(button, "width 38, height 38");
			form.addFormElement(button);
		}
	}
	return heads;
}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:22,代码来源:CharacterNameAppState.java


示例5: BuildToolArea

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
public BuildToolArea(ToolManager toolMgr, final ElementManager screen) {
	super(GameHudType.BUILD, toolMgr, screen, "BuildToolBar", "Buildbar", 7);
	//
	updateBarText();
	Container el = new Container(screen, UIDUtil.getUID(), mainToolBarStyle.getVector2f("propSearchPosition"),
			mainToolBarStyle.getVector2f("propSearchSize"), Vector4f.ZERO, null);
	el.setLayoutManager(new MigLayout(screen, "", "[][fill, grow][]", "[]"));
	propSearch = new AutocompleteTextField<String>(screen, this);
	propSearch.setToolTipText("Type in a partial or full prop name and press Ctrl+Space to list all props matching that name");
	el.addChild(new Label("Prop: ", screen));
	el.addChild(propSearch, "ay 50%");
	FancyButton add = new FancyButton(screen) {
		@Override
		public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
			BuildAppState bas = screen.getApplication().getStateManager().getState(BuildAppState.class);
			bas.add(propSearch.getText());
		}
	};
	add.setText("Add");
	el.addChild(add);
	container.addChild(el);
}
 
开发者ID:rockfireredmoon,项目名称:iceclient,代码行数:23,代码来源:BuildToolArea.java


示例6: forwardEvents

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
public void forwardEvents(NiftyInputConsumer nic) {
    int queueSize = inputQueue.size();

    for (int i = 0; i < queueSize; i++){
        InputEvent evt = inputQueue.get(i);
        if (evt instanceof MouseMotionEvent){
            onMouseMotionEventQueued( (MouseMotionEvent)evt, nic);
        }else if (evt instanceof MouseButtonEvent){
            onMouseButtonEventQueued( (MouseButtonEvent)evt, nic);
        }else if (evt instanceof KeyInputEvent){
            onKeyEventQueued( (KeyInputEvent)evt, nic);
        }
    }

    inputQueue.clear();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:17,代码来源:InputSystemJme.java


示例7: s3dOnTouchDownEvent

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void s3dOnTouchDownEvent(TouchEvent evt) {
	float x = ToolKit.isAndroid() ? touchXY.x : mouseXY.x;
	float y = ToolKit.isAndroid() ? touchXY.y : mouseXY.y;
	Node target = getEventNode(x, y);
	if (target != null) {
		MouseUIButtonEvent<NodeEventTarget> mevt = new MouseUIButtonEvent<NodeEventTarget>(
				new MouseButtonEvent(0, true, (int) x, (int) y), new NodeEventTarget(this, target),
				keyboardModifiers);
		if (target instanceof MouseButtonListener) {
			((MouseButtonListener<NodeEventTarget>) target).onMouseButton(mevt);
		}
		if (target instanceof TouchListener) {
			((TouchListener) target).onTouchDown(evt);
		}
		eventNodes.put(evt.getPointerId(), target);
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:19,代码来源:BaseScreen.java


示例8: 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


示例9: convertMouseButtonEvent

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
private void convertMouseButtonEvent(MouseEvent me, boolean isPressed) {
    int button = MouseInput.BUTTON_LEFT;
    switch (me.getButton()) {
        case NONE:
            return;
        case MIDDLE:
            button = MouseInput.BUTTON_MIDDLE;
            break;
        case PRIMARY:
            button = MouseInput.BUTTON_LEFT;
            break;
        case SECONDARY:
            button = MouseInput.BUTTON_RIGHT;
    }
    MouseButtonEvent mbe = new MouseButtonEvent(button, isPressed, (int)me.getX(), (int)me.getY());
    
    synchronized (eventQueue) {
        eventQueue.add(mbe);
    }
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:21,代码来源:JfxMouseInput.java


示例10: onMouseButtonEvent

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
@Override
public void onMouseButtonEvent( MouseButtonEvent evt ) {
    if( !isEnabled() ) {
        return;
    }
    if( evt.isPressed() ) {
        // Save the location for later
        clickStart.set(evt.getX(), evt.getY());
    } else if( evt.isReleased() ) {
        
        Vector2f click = new Vector2f(evt.getX(), evt.getY());
        if( click.distanceSquared(clickStart) < clickRadiusSq ) {
            processClickEvent(click, evt);
        }  
    }
}
 
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:17,代码来源:SelectionState.java


示例11: onMouseLeftReleased

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
@Override
public void onMouseLeftReleased(MouseButtonEvent evt) {
	if (isEnabled) {
		if (isPressed) {
			isPressed = false;
			if (doubleClick) {
				selectTextRangeDoubleClick();
				doubleClick = false;
			} else if (tripleClick) {
				selectTextRangeTripleClick();
				tripleClick = false;
			} else {
				setCaretPositionByXNoRange(evt.getX());
				if (caretIndex >= 0)
					this.setTextRangeEnd(caretIndex);
				else
					this.setTextRangeEnd(0);
			}
		}
	}
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:22,代码来源:TextField.java


示例12: DialogBox

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
/**
 * Creates a new instance of the Dialog control
 * 
 * @param screen The screen control the Element is to be added to
 * @param UID A unique String identifier for the Element
 * @param position A Vector2f containing the x/y position of the Element
 * @param dimensions A Vector2f containing the width/height dimensions of the Element
 * @param resizeBorders A Vector4f containg the border information used when resizing the default image (x = N, y = W, z = E, w = S)
 * @param defaultImg The default image to use for the DialogBox window
 */
public DialogBox(ElementManager screen, String UID, Vector2f position, Vector2f dimensions, Vector4f resizeBorders, String defaultImg) {
	super(screen, UID, position, dimensions, resizeBorders, defaultImg);
	
	Vector4f indents = screen.getStyle("Window").getVector4f("contentIndents");
	
	btnCancel = new ButtonAdapter(screen, UID + ":btnCancel",
		new Vector2f(
			indents.y,
			contentArea.getHeight()-screen.getStyle("Button").getVector2f("defaultSize").y-indents.w
		)
	) {
		@Override
		public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
			onButtonCancelPressed(evt, toggled);
		}
	};
	btnCancel.setText("Cancel");
	btnCancel.setDocking(Docking.SW);
	addWindowContent(btnCancel);
	form.addFormElement(btnCancel);
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:32,代码来源:DialogBox.java


示例13: setIsToggled

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
/**
 * Set a toggle button state to toggled/untoggled and calls the user left mouse button event methods
 * @param isToggled boolean
 */
public void setIsToggled(boolean isToggled) {
	this.isToggled = isToggled;
	
	if (pressedImg != null && isToggled) {
		runPressedEffect(false);
	} else {
		runResetEffect();
	}
	
	MouseButtonEvent evtd = new MouseButtonEvent(0,true,0,0);
	MouseButtonEvent evtu = new MouseButtonEvent(0,false,0,0);
	onButtonMouseLeftDown(evtd, isToggled);
	onButtonMouseLeftUp(evtu, isToggled);
	if (radioButtonGroup != null) {
		if (isToggled)
			radioButtonGroup.setSelected(this);
	}
	evtu.setConsumed();
	evtd.setConsumed();
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:25,代码来源:Button.java


示例14: onMouseLeftPressed

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
@Override
public void onMouseLeftPressed(MouseButtonEvent evt) {
	if (isEnabled) {
		if (isToggleButton) {
			if (isToggled) {
				if (!isRadioButton) isToggled = false;
			} else {
				isToggled = true;
			}
		}
		runPressedEffect(true);
		isStillPressed = true;
		initClickPause = true;
		currentInitClickTrack = 0;
		onButtonMouseLeftDown(evt, isToggled);
	}
	evt.setConsumed();
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:19,代码来源:Button.java


示例15: onMouseLeftReleased

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
@Override
public void onMouseLeftReleased(MouseButtonEvent evt) {
	if (isEnabled) {
		if (!isToggleButton) {
			if (getHasFocus()) {
				runLoseFocusEffect();
				runHoverEffect(false);
			} else {
				runLoseFocusEffect();
			}
		} else {
			if (!isToggled) {
				runLoseFocusEffect();
				runHoverEffect(false);
			}
		}
		isStillPressed = false;
		initClickPause = false;
		currentInitClickTrack = 0;
		onButtonMouseLeftUp(evt, isToggled);
		if (radioButtonGroup != null)
			radioButtonGroup.setSelected(this);
	}
	evt.setConsumed();
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:26,代码来源:Button.java


示例16: onMouseLeftReleased

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
@Override
public void onMouseLeftReleased(MouseButtonEvent evt) {
	if (isMultiselect) {
		if (shift || ctrl) {
			if (!selectedIndexes.contains(currentListItemIndex)) {
				addSelectedIndex(currentListItemIndex);
			} else {
				removeSelectedIndex(currentListItemIndex);
			}
		} else {
			setSelectedIndex(currentListItemIndex);
		}
	} else {
		if (currentListItemIndex >= 0 && currentListItemIndex < listItems.size())
			setSelectedIndex(currentListItemIndex);
		else
			selectedIndexes = new ArrayList();
	}
	evt.setConsumed();
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:21,代码来源:SelectList.java


示例17: addCheckBox

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
private void addCheckBox(int index, ChatChannel channel) {
	CheckBox checkbox = new CheckBox(screen, filtersScrollArea.getUID() + ":CheckBox:" + index,
		new Vector2f(8,filtersScrollArea.getTextPadding()+(index*filterLineHeight))
	) {
		@Override
		public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean isToggled) {
			((ChatChannel)getElementUserData()).setIsFiltered(!isToggled);
			rebuildChat();
		}
	};
	checkbox.setElementUserData(channel);
	checkbox.setScaleEW(false);
	checkbox.setScaleNS(false);
	checkbox.setDocking(Docking.SW);
	checkbox.setIsResizable(false);
	checkbox.setIsMovable(false);
	checkbox.setIgnoreMouse(false);
//	checkbox.setClippingLayer(filtersScrollArea);
	checkbox.addClippingLayer(filtersScrollArea);
	checkbox.setClipPadding(filtersScrollArea.getScrollableArea().getTextPadding());
	if (!channel.getIsFiltered())
		checkbox.setIsChecked(true);
	filtersScrollArea.addScrollableChild(checkbox);
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:25,代码来源:ChatBoxExt.java


示例18: createShiftButton

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
public ButtonAdapter createShiftButton() {
	button = new ButtonAdapter(screen,
		new Vector2f(x,y),
		new Vector2f(w,h)
	) {
		@Override
		public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean isToggled) {
			setGlobalShift(isToggled);
		}
	};
	button.setText(label);
	button.setIsToggleButton(true);
	button.setResetKeyboardFocus(false);
	button.removeEffect(Effect.EffectEvent.Hover);
	return button;
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:17,代码来源:Keyboard.java


示例19: createSymbolButton

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
public ButtonAdapter createSymbolButton() {
	button = new ButtonAdapter(screen,
		new Vector2f(x,y),
		new Vector2f(w,h)
	) {
		@Override
		public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean isToggled) {
			setGlobalSymbol(isToggled);
		}
	};
	button.setText(label);
	button.setIsToggleButton(true);
	button.setResetKeyboardFocus(false);
	button.removeEffect(Effect.EffectEvent.Hover);
	return button;
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:17,代码来源:Keyboard.java


示例20: androidTouchUpEvent

import com.jme3.input.event.MouseButtonEvent; //导入依赖的package包/类
private void androidTouchUpEvent(TouchEvent evt) {
	Element target = eventElements.get(evt.getPointerId());
	if (target != null) {
		if (target instanceof MouseButtonListener) {
			MouseButtonEvent mbEvt = new MouseButtonEvent(0, true, (int)evt.getX(), (int)evt.getY());
			((MouseButtonListener)target).onMouseLeftReleased(mbEvt);
		}
		if (target instanceof TouchListener) {
			((TouchListener)target).onTouchUp(evt);
		}
		if (!(target.getAbsoluteParent() instanceof AutoHide)) {
			handleAndroidMenuState(target);
		}
		if (target != null)
			evt.setConsumed();
		eventElements.remove(evt.getPointerId());
		contactElements.remove(evt.getPointerId());
		elementOffsets.remove(evt.getPointerId());
		eventElementResizeDirections.remove(evt.getPointerId());
	} else
		handleMenuState();
	mousePressed = false;
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:24,代码来源:SubScreen.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IIOReadProgressListener类代码示例发布时间:2022-05-21
下一篇:
Java LocalRepository类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap