当前位置: 首页>>代码示例>>Java>>正文


Java Window.addWindowResizeListener方法代码示例

本文整理汇总了Java中com.google.gwt.user.client.Window.addWindowResizeListener方法的典型用法代码示例。如果您正苦于以下问题:Java Window.addWindowResizeListener方法的具体用法?Java Window.addWindowResizeListener怎么用?Java Window.addWindowResizeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.user.client.Window的用法示例。


在下文中一共展示了Window.addWindowResizeListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ErrorPopup

import com.google.gwt.user.client.Window; //导入方法依赖的package包/类
/**
 * Initializes the ErrorPopup.
 */
ErrorPopup() {
  super(true); //constructor for PopupPanel class. "True" initializes the "auto-hide" variable
  
  
  // I'm leaving this setSTyleName line here as a comment, to show the typical way to define
  // the style.
  // I would have preferred to use this method rather than constructing the HTML by hand,
  // but it seems that GWT doesn't let the StyleName to be switched dynamically.
  // setStyleName("ode-ErrorMessage");

  messageLabel = new HTML();
  setWidget(messageLabel);

  // Recenter the message when the window is resized.
  // TODO(halabelson): replace the deprecated methods
  Window.addWindowResizeListener(new WindowResizeListener() {
    @Override
    public void onWindowResized(int width, int height) {
      centerTopPopup();
    }
  });

  // Reposition the message to the top of the screen when the
  // window is scrolled
  // TODO(halabelson): get rid of the flashing on vertical scrolling
  Window.addWindowScrollListener(new WindowScrollListener() {
    @Override
    public void onWindowScrolled(int scrollLeft, int scrollTop) {
      centerTopPopup();
    }
  });
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:36,代码来源:ErrorReporter.java

示例2: RpcStatusPopup

import com.google.gwt.user.client.Window; //导入方法依赖的package包/类
/**
 * Initializes the LoadingPopup.
 */
public RpcStatusPopup() {
  super(/* autoHide = */ false);
  setStyleName("ode-RpcStatusMessage");
  setWidget(label);

  // Re-center the loading message when the window is resized.
  // TODO(halabelson): Replace the deprecated methods
  Window.addWindowResizeListener(new WindowResizeListener() {
    @Override
    public void onWindowResized(int width, int height) {
      positionPopup(getOffsetWidth());
    }
  });

  // Reposition the message to the top of the screen when the
  // window is scrolled
  // TODO(halabelson): get rid of the flashing on vertical scrolling
  Window.addWindowScrollListener(new WindowScrollListener() {
    @Override
    public void onWindowScrolled(int scrollLeft, int scrollTop) {
      positionPopup(getOffsetWidth());
    }
  });

  // Position the popup before showing it to prevent flashing.
  setPopupPositionAndShow(new PopupPanel.PositionCallback() {
    @Override
    public void setPosition(int offsetWidth, int offsetHeight) {
      positionPopup(offsetWidth);
    }
  });
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:36,代码来源:RpcStatusPopup.java


注:本文中的com.google.gwt.user.client.Window.addWindowResizeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。