本文整理匯總了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);
}