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


Java MouseEvent类代码示例

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


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

示例1: segmentClick

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
protected void segmentClick(Segment segment, Event evt, boolean dblClick) {
  MouseEvent mouse = (MouseEvent) evt;

  // CTRL (add) pressed?
  boolean ctrl = false;
  if(mouse.getCtrlKey()) {
    ctrl = true;
  }

  // Unselect others on double click
  if(dblClick) {
    policy.deselectAllSegments();
  }
  policy.select(segment, ctrl);
  // update stylePolicy
  context.setStylingPolicy(policy);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:18,代码来源:CircleSegmentsVisualizer.java

示例2: handleEvent

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
/**
 * Handles 'mouseout' MouseEvent event type.
 */
public void handleEvent(Event evt) {
    MouseEvent me = (MouseEvent)evt;
    Element newTarget = (Element)me.getRelatedTarget();
    Cursor cursor = CursorManager.DEFAULT_CURSOR;
    if (newTarget != null)
        cursor = CSSUtilities.convertCursor
            (newTarget, BridgeContext.this);
    if (cursor == null)
        cursor = CursorManager.DEFAULT_CURSOR;

    userAgent.setSVGCursor(cursor);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:16,代码来源:BridgeContext.java

示例3: event

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
@Override
protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
	graphElement.getEventManager().mouseOver(graphElement,
			mouseEvent.getButton(), mouseEvent.getAltKey(),
			mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
			(int) point.getX(), (int) point.getY(),
			mouseEvent.getScreenX(), mouseEvent.getScreenY());
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:9,代码来源:SVGMouseOverEventListener.java

示例4: event

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
@Override
protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
	graphElement.getEventManager().mouseOut(graphElement,
			mouseEvent.getButton(), mouseEvent.getAltKey(),
			mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
			(int) point.getX(), (int) point.getY(),
			mouseEvent.getScreenX(), mouseEvent.getScreenY());
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:9,代码来源:SVGMouseOutEventListener.java

示例5: event

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
@Override
protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
	graphElement.getEventManager().mouseMoved(graphElement,
			mouseEvent.getButton(), mouseEvent.getAltKey(),
			mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
			(int) point.getX(), (int) point.getY(),
			mouseEvent.getScreenX(), mouseEvent.getScreenY());
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:9,代码来源:SVGMouseMovedEventListener.java

示例6: event

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
@Override
protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
	graphElement.getEventManager().mouseUp(graphElement,
			mouseEvent.getButton(), mouseEvent.getAltKey(),
			mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
			(int) point.getX(), (int) point.getY(),
			mouseEvent.getScreenX(), mouseEvent.getScreenY());
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:9,代码来源:SVGMouseUpEventListener.java

示例7: event

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
@Override
protected void event(SVGOMPoint point, MouseEvent evt) {
	graphElement.getEventManager().mouseDown(graphElement, evt.getButton(),
			evt.getAltKey(), evt.getCtrlKey(), evt.getMetaKey(),
			(int) point.getX(), (int) point.getY(), evt.getScreenX(),
			evt.getScreenY());
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:8,代码来源:SVGMouseDownEventListener.java

示例8: event

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
@Override
protected void event(SVGOMPoint point, MouseEvent evt) {
	graphElement.getEventManager().mouseClicked(graphElement,
			evt.getButton(), evt.getAltKey(), evt.getCtrlKey(),
			evt.getMetaKey(), (int) point.getX(), (int) point.getY(),
			evt.getScreenX(), evt.getScreenY());
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:8,代码来源:SVGMouseClickEventListener.java

示例9: handleEvent

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
@Override
public final void handleEvent(Event evt) {
	if (evt instanceof MouseEvent) {
		MouseEvent me = (MouseEvent) evt;
		SVGOMPoint point = screenToDocument((SVGLocatable) me.getTarget(),
				new SVGOMPoint(me.getClientX(), me.getClientY()));
		event(point, me);
		evt.stopPropagation();
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:11,代码来源:SVGEventListener.java

示例10: ExampleView

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
public ExampleView(Content<?> content)
{
	cameraRenderer= new CanvasDebugDraw((Element)content.getValue());
	exampleRunner= new ExampleRunner(cameraRenderer);
	HTMLCanvasElement canvas= cameraRenderer.getCanvas();

	EventDispatcherImpl.setEventListener(canvas, new EventListener()
	{
		public void handleEvent(Event event)
		{
			if (event instanceof MouseEvent)
			{
				MouseEvent mouseEvent= (MouseEvent) event;

				if (event.getType().equals("mousedown"))
					onMouseDown(mouseEvent);
				else if (event.getType().equals("mouseup"))
					onMouseUp(mouseEvent);
				else if (event.getType().equals("mousemove"))
					onMouseMove(mouseEvent);
			}
			else if (event instanceof KeyboardEvent)
			{
				KeyboardEvent keyboardEvent= (KeyboardEvent) event;

				if (event.getType().equals("keypress"))
					onKeyPress(keyboardEvent);
				else if (event.getType().equals("keyup"))
					onKeyUp(keyboardEvent);
				else if (event.getType().equals("keydown"))
					onKeyDown(keyboardEvent);
			}
		}
	}, "mousedown", "mouseup", "mousemove", "keypress", "keyup", "keydown");
}
 
开发者ID:dragome,项目名称:dragome-examples,代码行数:36,代码来源:ExampleView.java

示例11: onMouseUp

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
protected void onMouseUp(MouseEvent event)
{
	event.preventDefault();
	ExampleMouseEvent eme= new ExampleMouseEvent(ExampleMouseEvent.MOUSE_EVENT_TYPE_UP, event.getClientX(), event.getClientY(), event.getShiftKey());
	eme.dispatch(exampleRunner);

}
 
开发者ID:dragome,项目名称:dragome-examples,代码行数:8,代码来源:ExampleView.java

示例12: handleEvent

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
@Override
public void handleEvent(final org.w3c.dom.events.Event evt) {
    com.sun.webkit.dom.EventImpl eventImpl = (com.sun.webkit.dom.EventImpl) evt;
    Node target = (Node) evt.getTarget();
    Node currentTarget = (Node) evt.getCurrentTarget();
    WebKitElement elementImpl = (WebKitElement) ((WebKitPageContext) context).createElement(target, element.getDocument(), element.getEngine());
    WebKitElement currentElementImpl = (WebKitElement) ((WebKitPageContext) context).createElement(currentTarget, element.getDocument(), element.getEngine());
    EventAdapter ui4jEvent = new EventAdapter(evt.getType(), elementImpl, currentElementImpl);
    if (eventImpl instanceof MouseEventImpl) {
        MouseEventImpl mouseEventImpl = (MouseEventImpl) eventImpl;

        NodeImpl nodeImpl = (NodeImpl) target;
        JSObject rect = (JSObject) nodeImpl.eval("this.getBoundingClientRect()");

        // http://www.jacklmoore.com/notes/mouse-position
        int left = (int) Math.round(Double.parseDouble(rect.getMember("left").toString()));
        int top = (int) Math.round(Double.parseDouble(rect.getMember("top").toString()));

        int offsetX = mouseEventImpl.getClientX() - left;
        int offsetY = mouseEventImpl.getClientY() - top;

        ui4jEvent.setOffsetX(offsetX);
        ui4jEvent.setOffsetY(offsetY);

        if (evt instanceof MouseEvent) {
            MouseEvent me = (MouseEvent) evt;
            ui4jEvent.setClientX(me.getClientX());
            ui4jEvent.setClientY(me.getClientY());
        }
    }
    handler.handle(ui4jEvent);
}
 
开发者ID:webfolderio,项目名称:ui4j,代码行数:33,代码来源:WebKitEventListener.java

示例13: handleEvent

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
public void handleEvent(Event evt) {
    MouseEvent mevt = (MouseEvent)evt;
    fireDOMActivateEvent(evt.getTarget(), mevt.getDetail());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:5,代码来源:FocusManager.java

示例14: onMouseDown

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
protected void onMouseDown(MouseEvent event)
{
	event.preventDefault();
	ExampleMouseEvent eme= new ExampleMouseEvent(ExampleMouseEvent.MOUSE_EVENT_TYPE_DOWN, event.getClientX(), event.getClientY(), event.getShiftKey());
	eme.dispatch(exampleRunner);
}
 
开发者ID:dragome,项目名称:dragome-examples,代码行数:7,代码来源:ExampleView.java

示例15: onMouseMove

import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
protected void onMouseMove(MouseEvent event)
{
	event.preventDefault();
	ExampleMouseEvent eme= new ExampleMouseEvent(ExampleMouseEvent.MOUSE_EVENT_TYPE_MOVE, event.getClientX(), event.getClientY(), event.getShiftKey());
	eme.dispatch(exampleRunner);
}
 
开发者ID:dragome,项目名称:dragome-examples,代码行数:7,代码来源:ExampleView.java


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