javax.swing.JDialog.getHeight()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(106)

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

JDialog.getHeight介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

final JDialog d = new JDialog();
d.setSize(200, 200);
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final Dimension screenSize = toolkit.getScreenSize();
final int x = (screenSize.width - d.getWidth()) / 2;
final int y = (screenSize.height - d.getHeight()) / 2;
d.setLocation(x, y);
d.setVisible(true);

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

private Point findScreenCenter(JDialog dialog) {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    int x = toolkit.getScreenSize().width / 2 - dialog.getHeight() / 2;
    int y = toolkit.getScreenSize().height / 2 - dialog.getWidth() / 2;
    return new Point(x, y);
  }
}

代码示例来源:origin: danfickle/openhtmltopdf

/**
 * Description of the Method
 *
 * @param frame PARAM
 */
public static void center(JDialog frame) {
  //p("centering");
  Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
  frame.setLocation((int) ((screen_size.getWidth() - frame.getWidth()) / 2),
      (int) ((screen_size.getHeight() - frame.getHeight()) / 2));
}

代码示例来源:origin: org.xhtmlrenderer/core-renderer

/**
 * Description of the Method
 *
 * @param frame PARAM
 */
public static void center(JDialog frame) {
  //p("centering");
  Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
  frame.setLocation((int) ((screen_size.getWidth() - frame.getWidth()) / 2),
      (int) ((screen_size.getHeight() - frame.getHeight()) / 2));
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

/**
 * Description of the Method
 *
 * @param frame PARAM
 */
public static void center(JDialog frame) {
  //p("centering");
  Dimension screen_size = Toolkit.getDefaultToolkit().getScreenSize();
  frame.setLocation((int) ((screen_size.getWidth() - frame.getWidth()) / 2),
      (int) ((screen_size.getHeight() - frame.getHeight()) / 2));
}

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

private static Point fitToScreen( int x, int y, int altHeight ) {
  
  Rectangle screen = org.openide.util.Utilities.getUsableScreenBounds();
      
  Point p = new Point( x, y );
  
  // Adjust the x postition if necessary
  if ( ( p.x + popupWindow.getWidth() ) > ( screen.x + screen.width - X_INSET ) ) {
    p.x = screen.x + screen.width - X_INSET - popupWindow.getWidth(); 
  }
  
  // Adjust the y position if necessary
  if ( ( p.y + popupWindow.getHeight() ) > ( screen.y + screen.height - X_INSET ) ) {
    p.y = p.y - popupWindow.getHeight() - altHeight;
  }
  
  return p;     
}

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

private static Point fitToScreen(int x, int y, int altHeight) {
  Rectangle screen = org.openide.util.Utilities.getUsableScreenBounds();
  Point p = new Point(x, y);
  // Adjust the x postition if necessary
  if ((p.x + popupWindow.getWidth()) > (screen.x + screen.width - X_INSET)) {
    p.x = screen.x + screen.width - X_INSET - popupWindow.getWidth();
  }
  // Adjust the y position if necessary
  if ((p.y + popupWindow.getHeight()) > (screen.y + screen.height - X_INSET)) {
    p.y = p.y - popupWindow.getHeight() - altHeight;
  }
  return p;
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

public void run() {
    if (!window.isVisible()) {
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      taskLabel.setText(message);
      cancelledAction.setEnabled(true);
      window.setLocation(screenSize.width / 2 - window.getWidth() / 2,
          screenSize.height / 2 - window.getHeight() / 2);
      window.setVisible(true);
    }
  }
});

代码示例来源:origin: org.protege/protege-editor-owl

public void run() {
    if (!window.isVisible()) {
      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
      window.setLocation(screenSize.width / 2 - window.getWidth() / 2,
          screenSize.height / 2 - window.getHeight() / 2);
      window.setVisible(true);
    }
  }
});

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

public void rememberFrom(JDialog dialog) {
location = dialog.getLocation();
width = dialog.getWidth();
height = dialog.getHeight();
}

代码示例来源:origin: freeplane/freeplane

public static void setDialogLocationUnder(final JDialog dialog, final NodeModel node) {
  final Controller controller = Controller.getCurrentController();
  final IMapViewManager viewController = controller.getMapViewManager();
  final JComponent c = (JComponent) viewController.getComponent(node);
  final int x = 0;
  final int y = c.getHeight();
  final Point location = new Point(x, y);
  SwingUtilities.convertPointToScreen(location, c);
  UITools.setBounds(dialog, location.x, location.y, dialog.getWidth(), dialog.getHeight());
}

代码示例来源:origin: org.wildfly.core/wildfly-cli

public void actionPerformed(ActionEvent e) {
  JOptionPane helpPane = new JOptionPane(helpScroller, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION);
  JDialog dialog = helpPane.createDialog(HelpButton.this, "Help");
  dialog.setResizable(true);
  dialog.setModal(false);
  dialog.setSize(dialog.getHeight(), helpScroller.getWidth() + 10);
  dialog.setVisible(true);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-beans

private static void resizePopup() {
  popupWindow.pack();
  Point point = new Point(0,0);
  SwingUtilities.convertPointToScreen(point, getMainWindow());
  popupWindow.setLocation( point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2, 
               point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

/**
 * Save settings for a dialog
 * 
 * @param dialog
 *          the dialog
 */
public void saveSettings(JDialog dialog) {
 if (!dialog.getName().contains("dialog")) {
  storeWindowBounds(dialog.getName(), dialog.getX(), dialog.getY(), dialog.getWidth(), dialog.getHeight());
 }
}

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

private static void resizePopup() {
  popupWindow.pack();
  Point point = new Point(0, 0);
  SwingUtilities.convertPointToScreen(point, getMainWindow());
  popupWindow.setLocation(point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2,
      point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}
private static final int X_INSET = 10;

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils-ui

private static void resizePopup() {
  popupWindow.pack();
  Point point = new Point(0, 0);
  SwingUtilities.convertPointToScreen(point, getMainWindow());
  popupWindow.setLocation(point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2,
      point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}
private static final int X_INSET = 10;

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor

private static void resizePopup() {
  popupWindow.pack();
  Point point = new Point(0, 0);
  SwingUtilities.convertPointToScreen(point, getMainWindow());
  popupWindow.setLocation(point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2,
               point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}

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

private static void resizePopup() {
  popupWindow.pack();
  Point point = new Point(0,0);
  SwingUtilities.convertPointToScreen(point, getMainWindow());
  popupWindow.setLocation( point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2, 
               point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}

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

private static void resizePopup() {
  popupWindow.pack();
  Point point = new Point(0,0);
  SwingUtilities.convertPointToScreen(point, getMainWindow());
  popupWindow.setLocation( point.x + (getMainWindow().getWidth() - popupWindow.getWidth()) / 2, 
               point.y + (getMainWindow().getHeight() - popupWindow.getHeight()) / 3);
}

代码示例来源:origin: freeplane/freeplane

public void storeDialogPositions(final JDialog dialog, final String window_preference_storage_property) {
  setX((dialog.getX()));
  setY((dialog.getY()));
  setWidth((dialog.getWidth()));
  setHeight((dialog.getHeight()));
  final String marshalled = marshall();
  ResourceController.getResourceController().setProperty(window_preference_storage_property, marshalled);
}

相关文章

JDialog类方法