2017-02-28 2 views
1

GXT에서 창 Y 축 위치를 얻는 방법은 무엇입니까? setPosition을 사용하여 위치를 설정할 수 있습니다. 그러나 나는 방법을 얻지 못해서 입장을 취할 수 없다. 창문 위치를 찾는 데 나를 도와 주시겠습니까?gxt에서 창 x 위치를 얻는 방법

Window window = new Window(); 
window.setClosable(true); 
window.setWidth(300); 
window.setHeight(300); 
window.setPosition(30, 50); 
당신은 GWT의 모든 요소로 얻을 수

답변

0

가 가진 요소의 위치 :

/** 
* 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의 모든 위젯은 상속받습니다.

희망이 있습니다.

+0

getAbsoluteLeft() 및 getAbsoluteTop()에 대해 항상 0을 얻고 있습니다. – user2207

+0

위젯은 위치를 얻기 위해 DOM에 연결되어야합니다. –