org.eclipse.jface.window.Window.getConstrainedShellBounds()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(80)

本文整理了Java中org.eclipse.jface.window.Window.getConstrainedShellBounds()方法的一些代码示例,展示了Window.getConstrainedShellBounds()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.getConstrainedShellBounds()方法的具体详情如下:
包路径:org.eclipse.jface.window.Window
类名称:Window
方法名:getConstrainedShellBounds

Window.getConstrainedShellBounds介绍

[英]Given the desired position of the window, this method returns an adjusted position such that the window is no larger than its monitor, and does not extend beyond the edge of the monitor. This is used for computing the initial window position, and subclasses can use this as a utility method if they want to limit the region in which the window may be moved.
[中]给定所需的窗口位置,此方法返回调整后的位置,使窗口不大于其监视器,且不超出监视器边缘。这用于计算初始窗口位置,如果子类希望限制窗口可能移动的区域,则可以将其用作实用方法。

代码示例

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

/**
 * Constrain the shell size to be no larger than the display bounds.
 *
 * @since 2.0
 */
protected void constrainShellSize() {
  // limit the shell size to the display size
  Rectangle bounds = shell.getBounds();
  Rectangle constrained = getConstrainedShellBounds(bounds);
  if (!bounds.equals(constrained)) {
    shell.setBounds(constrained);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

/**
 * Constrain the shell size to be no larger than the display bounds.
 *
 * @since 2.0
 */
protected void constrainShellSize() {
  // limit the shell size to the display size
  Rectangle bounds = shell.getBounds();
  Rectangle constrained = getConstrainedShellBounds(bounds);
  if (!bounds.equals(constrained)) {
    shell.setBounds(constrained);
  }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

/**
 * Constrain the shell size to be no larger than the display bounds.
 * 
 * @since 1.0
 */
protected void constrainShellSize() {
  // limit the shell size to the display size
  Rectangle bounds = shell.getBounds();
  Rectangle constrained = getConstrainedShellBounds(bounds);
  if (!bounds.equals(constrained)) {
    shell.setBounds(constrained);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

/**
 * Initializes the location and size of this window's SWT shell after it has
 * been created.
 * <p>
 * This framework method is called by the <code>create</code> framework
 * method. The default implementation calls <code>getInitialSize</code>
 * and <code>getInitialLocation</code> and passes the results to
 * <code>Shell.setBounds</code>. This is only done if the bounds of the
 * shell have not already been modified. Subclasses may extend or
 * reimplement.
 * </p>
 */
protected void initializeBounds() {
  if (resizeListener != null) {
    shell.removeListener(SWT.Resize, resizeListener);
  }
  if (resizeHasOccurred) { // Check if shell size has been set already.
    return;
  }
  Point size = getInitialSize();
  Point location = getInitialLocation(size);
  shell.setBounds(getConstrainedShellBounds(new Rectangle(location.x,
      location.y, size.x, size.y)));
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

/**
 * Initializes the location and size of this window's SWT shell after it has
 * been created.
 * <p>
 * This framework method is called by the <code>create</code> framework
 * method. The default implementation calls <code>getInitialSize</code>
 * and <code>getInitialLocation</code> and passes the results to
 * <code>Shell.setBounds</code>. This is only done if the bounds of the
 * shell have not already been modified. Subclasses may extend or
 * reimplement.
 * </p>
 */
protected void initializeBounds() {
  if (resizeListener != null) {
    shell.removeListener(SWT.Resize, resizeListener);
  }
  if (resizeHasOccurred) { // Check if shell size has been set already.
    return;
  }
  Point size = getInitialSize();
  Point location = getInitialLocation(size);
  shell.setBounds(getConstrainedShellBounds(new Rectangle(location.x,
      location.y, size.x, size.y)));
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

/**
 * Initializes the location and size of this window's SWT shell after it has
 * been created.
 * <p>
 * This framework method is called by the <code>create</code> framework
 * method. The default implementation calls <code>getInitialSize</code>
 * and <code>getInitialLocation</code> and passes the results to
 * <code>Shell.setBounds</code>. This is only done if the bounds of the
 * shell have not already been modified. Subclasses may extend or
 * reimplement.
 * </p>
 */
protected void initializeBounds() {
  if (resizeListener != null) {
    shell.removeListener(SWT.Resize, resizeListener);
  }
  if (resizeHasOccurred) { // Check if shell size has been set already.
    return;
  }
  Point size = getInitialSize();
  Point location = getInitialLocation(size);
  shell.setBounds(getConstrainedShellBounds(new Rectangle(location.x,
      location.y, size.x, size.y)));
}

相关文章