本文整理汇总了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);
}
示例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);
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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();
}
}
示例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");
}
示例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);
}
示例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);
}
示例13: handleEvent
import org.w3c.dom.events.MouseEvent; //导入依赖的package包/类
public void handleEvent(Event evt) {
MouseEvent mevt = (MouseEvent)evt;
fireDOMActivateEvent(evt.getTarget(), mevt.getDetail());
}
示例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);
}
示例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);
}