/** * Gets the location of the applications mainframe. * * @return Point object. */ public Point getLocationOnScreen() { return frame.getLocationOnScreen(); }
/** * Gets the location of the applications mainframe. * * @return Point object. */ public Point getLocationOnScreen() { return frame.getLocationOnScreen(); }
public Point getWindowLocation() { if (this.screenLocation != null) { return this.screenLocation; } this.screenLocation = this.hostControl.getLocationOnScreen(); return this.screenLocation; }
@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(); } };
@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(); } };
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); }
Rectangle gcBounds = gc[i].getBounds(); Point loc = mainWindow.getLocationOnScreen(); if (gcBounds.contains(loc)) { System.out.println("at " + j + " screen");
Point p = mainFrame.getLocationOnScreen(); Dimension d1 = mainFrame.getSize(); Dimension d2 = dialog.getSize();
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); }
/** * 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); }
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); }