本文整理匯總了Java中com.google.gwt.user.client.Element.getAbsoluteTop方法的典型用法代碼示例。如果您正苦於以下問題:Java Element.getAbsoluteTop方法的具體用法?Java Element.getAbsoluteTop怎麽用?Java Element.getAbsoluteTop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.user.client.Element
的用法示例。
在下文中一共展示了Element.getAbsoluteTop方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onMouseOver
import com.google.gwt.user.client.Element; //導入方法依賴的package包/類
@Override
public void onMouseOver(MouseOverEvent<Appointment> event) {
final Element element = (Element)event.getElement();
final Appointment appt = event.getTarget();
final StringBuilder t = new StringBuilder("<p><b>").append(appt.getTitle()).append("</b></p>");
if (appt.getDescription() != null) {
t.append(appt.getDescription());
}
t.append("<p><i>").append(Constants.INSTANCE.dblClickToExplore()).append("</i></p>");
appointmentPopup.setWidget(new HTML(t.toString()));
int left = element.getAbsoluteLeft() + 10;
int top = element.getAbsoluteTop() + 10;
appointmentPopup.setPopupPosition(left, top);
appointmentPopup.show();
}
示例2: isCursorInsideActualItem
import com.google.gwt.user.client.Element; //導入方法依賴的package包/類
/**
* Detects whether mouse cursor is inside actual item.
*
* @return returns true if mouse cursor is inside actual item
*/
private boolean isCursorInsideActualItem(TreeItem clickedItem) {
if (clickedItem == null) {
return false;
}
Element selectedElement = Draggable.getSelectedElement(clickedItem.getElement());
if (selectedElement == null) {
return false;
}
return mouseX >= selectedElement.getAbsoluteLeft() && mouseX <= selectedElement.getAbsoluteRight()
&& mouseY >= selectedElement.getAbsoluteTop() && mouseY <= selectedElement.getAbsoluteBottom();
}