[英]how to get x y position of a window in gxt
如何在GXT中獲取窗口的XY位置? 我可以使用setPosition設置位置。 但由於沒有get方法,我無法獲得該位置。 你能幫我檢查一下窗戶的位置嗎?
Window window = new Window();
window.setClosable(true);
window.setWidth(300);
window.setHeight(300);
window.setPosition(30, 50);
對於GWT中的每個元素,您可以獲得元素的位置:
/**
* Gets the object's absolute left position in pixels, as measured from the
* browser window's client area.
*
* @return the object's absolute left position
*/
window.getAbsoluteLeft();
和
/**
* Gets the object's absolute top position in pixels, as measured from the
* browser window's client area.
*
* @return the object's absolute top position
*/
window.getAbsoluteTop();
這兩種方法都是GWT中UiObject類的一部分,GWT 2中的每個小部件都繼承這種方法。
希望有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.