繁体   English   中英

如何在gxt中获取窗口的xy位置

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM