本文整理汇总了Java中com.google.gwt.user.client.ui.AbsolutePanel.getAbsoluteLeft方法的典型用法代码示例。如果您正苦于以下问题:Java AbsolutePanel.getAbsoluteLeft方法的具体用法?Java AbsolutePanel.getAbsoluteLeft怎么用?Java AbsolutePanel.getAbsoluteLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.AbsolutePanel
的用法示例。
在下文中一共展示了AbsolutePanel.getAbsoluteLeft方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMouseMove
import com.google.gwt.user.client.ui.AbsolutePanel; //导入方法依赖的package包/类
public void onMouseMove(Widget source, int x, int y) {
if (dragging) {
// System.out.println("MOUSE MOVE:" + x + "," + y);
AbsolutePanel rootPanel = getAbsoluteWidgetPanel(dragWidget);
int newX = x + dragWidget.getAbsoluteLeft() - xOffset;
int newY = y + dragWidget.getAbsoluteTop() - yOffset;
int rootOffsetY = newY - rootPanel.getAbsoluteTop();
int rootOffsetX = newX-rootPanel.getAbsoluteLeft();
if (rootOffsetX < 0) {
rootOffsetX = 0;
}
if (rootOffsetY < 0) {
rootOffsetY = 0;
}
rootPanel.setWidgetPosition(dragWidget, rootOffsetX, rootOffsetY);
}
}
示例2: center
import com.google.gwt.user.client.ui.AbsolutePanel; //导入方法依赖的package包/类
private void center(AbsolutePanel panel, Widget w) {
int left = panel.getAbsoluteLeft();
int top = panel.getAbsoluteTop();
int aHeight = Window.getClientHeight();
int aWidth = Window.getClientWidth();
int wHeight = w.getOffsetHeight();
int wWidth = w.getOffsetWidth();
int centerLeft = left + (aWidth/2) - (wWidth/2);
int centerTop = top + (aHeight/2) - (wHeight/2);
panel.setWidgetPosition(w, centerLeft, centerTop);
}