本文整理汇总了Java中com.google.gwt.event.dom.client.MouseEvent.getClientX方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.getClientX方法的具体用法?Java MouseEvent.getClientX怎么用?Java MouseEvent.getClientX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.event.dom.client.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.getClientX方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMouseInfo
import com.google.gwt.event.dom.client.MouseEvent; //导入方法依赖的package包/类
private static Map<String,String> getMouseInfo(MouseEvent event) {
Map<String,String> mouseInfo = new HashMap<String,String>();
int posX = -1;
int posY = -1;
try {
// In QTree class a SelectionEvent is translated to a ClickEvent,
// so position X and Y are not present (nativeEvent is null, is used to get the clientX and clientY)
posX = event.getClientX();
posY = event.getClientY();
} catch (Exception e) {
// Ignore
}
mouseInfo.put(EventDataI.MOUSE_X, String.valueOf(posX));
mouseInfo.put(EventDataI.MOUSE_Y, String.valueOf(posY));
return mouseInfo;
}
示例2: getClientPosition
import com.google.gwt.event.dom.client.MouseEvent; //导入方法依赖的package包/类
protected Coordinate getClientPosition(MouseEvent<?> event) {
return new Coordinate(event.getClientX(), event.getClientY());
}
示例3: PressCancelEvent
import com.google.gwt.event.dom.client.MouseEvent; //导入方法依赖的package包/类
public PressCancelEvent(MouseEvent<MouseOutHandler> sourceEvent) {
super(sourceEvent);
clientXPos = sourceEvent.getClientX();
clientYPos = sourceEvent.getClientY();
screenXPos = sourceEvent.getScreenX();
screenYPos = sourceEvent.getScreenY();
}
示例4: updateMousePosition
import com.google.gwt.event.dom.client.MouseEvent; //导入方法依赖的package包/类
private void updateMousePosition(MouseEvent<?> e) {
mouse.x = e.getClientX();
mouse.y = e.getClientY();
OMSVGRect viewbox = svg.getViewBox().getBaseVal();
offset.x = (int) viewbox.getX();
offset.y = (int) viewbox.getY();
}
示例5: FromMouseEvent
import com.google.gwt.event.dom.client.MouseEvent; //导入方法依赖的package包/类
public static Point FromMouseEvent(MouseEvent event) {
return new Point(event.getClientX(), event.getClientY());
}