2
어떻게 GWT에서 마우스를 클릭 한 위치에 팝업을 배치 할 수 있습니까? 나는 getX를 사용하고 flextable에 getY를 시도하고 그 위치에 Popup을 설정했지만 작동하지 않습니다.위치 지정 팝업 GWT
어떻게 GWT에서 마우스를 클릭 한 위치에 팝업을 배치 할 수 있습니까? 나는 getX를 사용하고 flextable에 getY를 시도하고 그 위치에 Popup을 설정했지만 작동하지 않습니다.위치 지정 팝업 GWT
빠른 예 :
final RootLayoutPanel rootLayoutPanel = RootLayoutPanel.get();
final FocusPanel focusPanel = new FocusPanel();
/* just to make the clickable area visible */
focusPanel.getElement().getStyle().setBackgroundColor("red");
rootLayoutPanel.add(focusPanel);
final PopupPanel popupPanel = new PopupPanel();
popupPanel.add(new Label("Popup"));
popupPanel.show();
focusPanel.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
final int left = event.getClientX();
final int top = event.getClientY();
popupPanel.setPopupPosition(left, top);
}
});
주 :
left = event.getRelativeX(myContextElem);
사용), 당신은 선택적으로 사용할 수 있습니다 MouseDownHandler를 호출하지만이 경우 sinkEvents(Event.ONMOUSEDOWN)
을 호출해야합니다.