org.openide.util.Utilities.findCenterBounds()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(94)

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

Utilities.findCenterBounds介绍

[英]Helps client code place components on the center of the screen. It handles multiple monitor configuration correctly
[中]帮助客户端代码将组件放置在屏幕中央。它可以正确处理多个监视器配置

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util

/**
 * Helps client code place components on the center of the screen.  It
 * handles multiple monitor configuration correctly
 *
 * @param componentSize the size of the component
 * @return bounds of the centered component
 *
 * @since 2.5
 */
public static Rectangle findCenterBounds(Dimension componentSize) {
  return findCenterBounds(getCurrentGraphicsConfiguration(), componentSize);
}

代码示例来源:origin: org.netbeans.api/org-openide-util

dialog.setBounds(findCenterBounds(parent.getGraphicsConfiguration(), dialog.getSize()));

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

/**
 * Helps client code place components on the center of the screen.  It
 * handles multiple monitor configuration correctly
 *
 * @param componentSize the size of the component
 * @return bounds of the centered component
 *
 * @since 2.5
 */
public static Rectangle findCenterBounds(Dimension componentSize) {
  return findCenterBounds(getCurrentGraphicsConfiguration(), componentSize);
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

/** Tries to resize wizard wisely if needed. Keeps "display inertia" so that
 * wizard is only enlarged, not shrinked, and location is changed only when
 * wizard window exceeds screen bounds after resize.
 */
private void resizeWizard(Window parentWindow, Dimension prevSize) {
  assert SwingUtilities.isEventDispatchThread () : "getComponent() must be called in EQ only.";
  Dimension curSize = data.getIterator(this).current().getComponent().getPreferredSize();
  // only enlarge if needed, don't shrink
  if ((curSize.width > prevSize.width) || (curSize.height > prevSize.height)) {
    Rectangle origBounds = parentWindow.getBounds();
    int newWidth = Math.max(origBounds.width + (curSize.width - prevSize.width), origBounds.width);
    int newHeight = Math.max(origBounds.height + (curSize.height - prevSize.height), origBounds.height);
    Rectangle screenBounds = Utilities.getUsableScreenBounds();
    Rectangle newBounds;
    // don't allow to exceed screen size, center if needed
    if (((origBounds.x + newWidth) > screenBounds.width) || ((origBounds.y + newHeight) > screenBounds.height)) {
      newWidth = Math.min(screenBounds.width, newWidth);
      newHeight = Math.min(screenBounds.height, newHeight);
      newBounds = Utilities.findCenterBounds(new Dimension(newWidth, newHeight));
    } else {
      newBounds = new Rectangle(origBounds.x, origBounds.y, newWidth, newHeight);
    }
    parentWindow.setBounds(newBounds);
    parentWindow.invalidate();
    parentWindow.validate();
    parentWindow.repaint();
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

d.width = Math.min(d.width, maxW);
d.height = Math.min(d.height, maxH);
setBounds(Utilities.findCenterBounds(d));

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

dialog.setBounds(findCenterBounds(parent.getGraphicsConfiguration(), dialog.getSize()));

代码示例来源:origin: org.netbeans.api/org-openide-nodes

setBounds(org.openide.util.Utilities.findCenterBounds(getSize()));

代码示例来源:origin: in.jlibs/org-openide-util

/**
 * Helps client code place components on the center of the screen.  It
 * handles multiple monitor configuration correctly
 *
 * @param componentSize the size of the component
 * @return bounds of the centered component
 *
 * @since 2.5
 */
public static Rectangle findCenterBounds(Dimension componentSize) {
  return findCenterBounds(getCurrentGraphicsConfiguration(), componentSize);
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util

/**
 * Helps client code place components on the center of the screen.  It
 * handles multiple monitor configuration correctly
 *
 * @param componentSize the size of the component
 * @return bounds of the centered component
 *
 * @since 2.5
 */
public static Rectangle findCenterBounds(Dimension componentSize) {
  return findCenterBounds(getCurrentGraphicsConfiguration(), componentSize);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/**
 * Helps client code place components on the center of the screen.  It
 * handles multiple monitor configuration correctly
 *
 * @param componentSize the size of the component
 * @return bounds of the centered component
 *
 * @since 2.5
 */
public static Rectangle findCenterBounds(Dimension componentSize) {
  return findCenterBounds(getCurrentGraphicsConfiguration(),
              componentSize);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/**
 * Helps client code place components on the center of the screen.  It
 * handles multiple monitor configuration correctly
 *
 * @param componentSize the size of the component
 * @return bounds of the centered component
 *
 * @since 2.5
 */
public static Rectangle findCenterBounds(Dimension componentSize) {
  return findCenterBounds(getCurrentGraphicsConfiguration(),
              componentSize);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public void applyto(JDialog dialog) {
  if (location != null) {
    dialog.setLocation(location);
  } else {
    dialog.setBounds(Utilities.findCenterBounds(dialog.getSize()));
  }
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-j2eeserver

/** Display the modal progress dialog. This method should be called from the
  AWT Event Dispatch thread. */
public void showProgressDialog() {
  if (finished) {
    return; // do not display the dialog if we are done
  }
  dialog = new JDialog(WindowManager.getDefault().getMainWindow(), title, true);
  dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
  String lastMessageTmp;
  synchronized (this) {
    lastMessageTmp = lastMessage;
  }
  dialog.getContentPane().add(createProgressDialog(
                  handle, 
                  lastMessageTmp != null ? lastMessageTmp : title));
  dialog.pack();
  dialog.setBounds(Utilities.findCenterBounds(dialog.getSize()));
  dialog.setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
  dialog.setVisible(true);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

newWidth = Math.min(screenBounds.width, newWidth);
  newHeight = Math.min(screenBounds.height, newHeight);
  newBounds = Utilities.findCenterBounds(new Dimension(newWidth, newHeight));
} else {
  newBounds = new Rectangle(origBounds.x, origBounds.y, newWidth, newHeight);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

newWidth = Math.min(screenBounds.width, newWidth);
  newHeight = Math.min(screenBounds.height, newHeight);
  newBounds = Utilities.findCenterBounds(new Dimension(newWidth, newHeight));
} else {
  newBounds = new Rectangle(origBounds.x, origBounds.y, newWidth, newHeight);

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

d.width = Math.min(d.width, maxW);
d.height = Math.min(d.height, maxH);
setBounds(Utilities.findCenterBounds(d));

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

d.width = Math.min(d.width, maxW);
d.height = Math.min(d.height, maxH);
setBounds(Utilities.findCenterBounds(d));

代码示例来源:origin: org.gephi/desktop-io-export

d.width = Math.min(d.width, maxW);
d.height = Math.min(d.height, maxH);
setBounds(Utilities.findCenterBounds(d));

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

dialog.setBounds(findCenterBounds(parent.getGraphicsConfiguration(),
                 dialog.getSize()));

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

dialog.setBounds(findCenterBounds(parent.getGraphicsConfiguration(),
                 dialog.getSize()));

相关文章

微信公众号

最新文章

更多