本文整理了Java中javax.swing.JFrame.getLocationOnScreen()
方法的一些代码示例,展示了JFrame.getLocationOnScreen()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.getLocationOnScreen()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:getLocationOnScreen
暂无
代码示例来源:origin: cytoscape/application
/**
* Gets the location of the applications mainframe.
*
* @return Point object.
*/
public Point getLocationOnScreen() {
return frame.getLocationOnScreen();
}
代码示例来源:origin: org.cytoscape/swing-application-impl
/**
* Gets the location of the applications mainframe.
*
* @return Point object.
*/
public Point getLocationOnScreen() {
return frame.getLocationOnScreen();
}
代码示例来源:origin: gurkenlabs/litiengine
public Point getWindowLocation() {
if (this.screenLocation != null) {
return this.screenLocation;
}
this.screenLocation = this.hostControl.getLocationOnScreen();
return this.screenLocation;
}
代码示例来源:origin: org.antlr/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: io.virtdata/virtdata-lib-realer
@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: stackoverflow.com
public static void saveImage(JFrame frame, File target, String extension) throws IOException{
Point pos = frame.getLocationOnScreen();
Dimension size = frame.getSize();
Rectangle rect = new Rectangle(pos.x, pos.y, size.width, size.height);
Robot robot = new Robot();
BufferedImage bi = robot.createScreenCapture(rect);
ImageIO.write(bi, extension, target);
}
代码示例来源:origin: stackoverflow.com
Rectangle gcBounds = gc[i].getBounds();
Point loc = mainWindow.getLocationOnScreen();
if (gcBounds.contains(loc)) {
System.out.println("at " + j + " screen");
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
Point p = mainFrame.getLocationOnScreen();
Dimension d1 = mainFrame.getSize();
Dimension d2 = dialog.getSize();
代码示例来源:origin: net.sf.squirrel-sql.plugins/graph
private void showDialogWindow(Rectangle bounds, String title)
{
if(null != _frameWindow)
{
title = _frameWindow.getTitle();
bounds = _frameWindow.getBounds();
Point locOnScreen = _frameWindow.getLocationOnScreen();
bounds.x = locOnScreen.x;
bounds.y = locOnScreen.y;
_frameWindow.setVisible(false);
_frameWindow.removeWindowListener(_windowAdapter);
_frameWindow.getContentPane().removeAll();
_frameWindow.dispose();
_frameWindow = null;
}
Frame owningFrame = GUIUtils.getOwningFrame(_session.getObjectTreeAPIOfActiveSessionWindow().getDetailTabComp());
_dlgWindow = new JDialog(owningFrame);
_dlgWindow.setTitle(title);
_dlgWindow.getContentPane().setLayout(new GridLayout(1, 1));
_dlgWindow.getContentPane().add(_contentPanel);
_dlgWindow.setBounds(bounds);
_dlgWindow.addWindowListener(_windowAdapter);
_dlgWindow.setVisible(true);
}
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core
/**
* Called by about button. Raises about dialog. Currently the about box has
* the product image and the copyright notice. The dialog box is centered
* over the MainFrame.
*/
private void about() {
JFrame mainFrame = GuiPackage.getInstance().getMainFrame();
JDialog dialog = initDialog(mainFrame);
// NOTE: these lines center the about dialog in the current window.
Point p = mainFrame.getLocationOnScreen();
Dimension d1 = mainFrame.getSize();
Dimension d2 = dialog.getSize();
dialog.setLocation(p.x + (d1.width - d2.width) / 2, p.y + (d1.height - d2.height) / 2);
dialog.setVisible(true);
}
代码示例来源:origin: cpesch/RouteConverter
private void show(String message) {
label.setText(message);
JFrame frame = getFrame();
if(frame == null)
return;
Point locationOnScreen = frame.getLocationOnScreen();
Dimension frameSize = getFrame().getSize();
window.pack();
window.setLocation(locationOnScreen.x + frameSize.width - label.getWidth() - 25,
locationOnScreen.y + frameSize.height - label.getHeight() - 25);
window.setVisible(true);
}
内容来源于网络,如有侵权,请联系作者删除!