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

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

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

JDialog.getLocationOnScreen介绍

暂无

代码示例

代码示例来源:origin: cytoscape/application

/**
 * Creates a new PopupTextArea object.
 *
 * @param parent  DOCUMENT ME!
 * @param title  DOCUMENT ME!
 * @param text  DOCUMENT ME!
 */
public PopupTextArea(JDialog parent, String title, String text) {
  super(parent, false);
  location = parent.getLocationOnScreen();
  init(title, text);
}

代码示例来源:origin: uk.co.nichesolutions/antlr4

public void windowClosing(WindowEvent e) {
    prefs.putInt(DIALOG_WIDTH_PREFS_KEY, (int) dialog.getSize().getWidth());
    prefs.putInt(DIALOG_HEIGHT_PREFS_KEY, (int) dialog.getSize().getHeight());
    prefs.putDouble(DIALOG_X_PREFS_KEY, dialog.getLocationOnScreen().getX());
    prefs.putDouble(DIALOG_Y_PREFS_KEY, dialog.getLocationOnScreen().getY());
    prefs.putInt(DIALOG_DIVIDER_LOC_PREFS_KEY, splitPane.getDividerLocation());
    prefs.putDouble(DIALOG_VIEWER_SCALE_PREFS_KEY, viewer.getScale());
    dialog.setVisible(false);
    dialog.dispose();
  }
};

代码示例来源:origin: com.tunnelvisionlabs/antlr4

@Override
  public void windowClosing(WindowEvent e) {
    prefs.putInt(DIALOG_WIDTH_PREFS_KEY, (int) dialog.getSize().getWidth());
    prefs.putInt(DIALOG_HEIGHT_PREFS_KEY, (int) dialog.getSize().getHeight());
    prefs.putDouble(DIALOG_X_PREFS_KEY, dialog.getLocationOnScreen().getX());
    prefs.putDouble(DIALOG_Y_PREFS_KEY, dialog.getLocationOnScreen().getY());
    prefs.putInt(DIALOG_DIVIDER_LOC_PREFS_KEY, splitPane.getDividerLocation());
    prefs.putDouble(DIALOG_VIEWER_SCALE_PREFS_KEY, viewer.getScale());
    dialog.setVisible(false);
    dialog.dispose();
  }
};

代码示例来源:origin: net.sf.squirrel-sql.plugins/graph

private void showFrameWindow(Rectangle bounds, String title)
{
 if(null != _dlgWindow)
 {
   title = _dlgWindow.getTitle();
   bounds = _dlgWindow.getBounds();
   Point locOnScreen = _dlgWindow.getLocationOnScreen();
   bounds.x = locOnScreen.x;
   bounds.y = locOnScreen.y;
   _dlgWindow.setVisible(false);
   _dlgWindow.removeWindowListener(_windowAdapter);
   _dlgWindow.getContentPane().removeAll();
   _dlgWindow.dispose();
   _dlgWindow = null;
 }
 ImageIcon appIcon = _session.getApplication().getResources().getIcon(SquirrelResources.IImageNames.APPLICATION_ICON);
 _frameWindow = new JFrame();
 _frameWindow.setTitle(title);
 _frameWindow.setIconImage(appIcon.getImage());
 _frameWindow.getContentPane().setLayout(new GridLayout(1, 1));
 _frameWindow.getContentPane().add(_contentPanel);
 _frameWindow.setBounds(bounds);
 _frameWindow.addWindowListener(_windowAdapter);
 _frameWindow.setVisible(true);
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-swing-action

return;
Point parentLocation = parentUI.getLocationOnScreen();
Dimension parentSize = parentUI.getSize();

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

/**
 * Adjusts the size of the dialog to the preferred size, but only if that
 * is bigger than the current size.
 */
private void adjustSize() {
  if (dialog.isVisible()) {
    Dimension p = dialog.getPreferredSize();
    Point bottomRight = dialog.getLocationOnScreen();
    bottomRight.translate(p.width, p.height);
    if (bigger(p, dialog.getSize())
        && GuiUtil.isPointOnScreen(bottomRight)) {
      dialog.pack();
    }
  }
}

相关文章

JDialog类方法