List of usage examples for javax.swing JInternalFrame getBounds
public Rectangle getBounds()
From source file:com.github.srec.rec.DefaultScreenShot.java
private Rectangle getScreenSize(JInternalFrame iframe) { Point p = iframe.getLocationOnScreen(); Rectangle r = iframe.getBounds(); r.setLocation(p);/* w ww.j a va 2 s .c o m*/ return r; }
From source file:org.intermine.common.swing.WindowUtils.java
/** * Centre the internal frame <code>win</code> over the internal * frame <code>parent</code>. * //from w w w . java2 s . co m * @param win The JInternalFrame to position. * @param parent The reference JInternalFrame. */ public static void centreOverFrame(JInternalFrame win, JInternalFrame parent) { Rectangle parentBounds = parent.getBounds(); Dimension windowSize = win.getSize(); int x = (parentBounds.width - windowSize.width) / 2; int y = (parentBounds.height - windowSize.height) / 2; x = Math.max(0, x + parentBounds.x); y = Math.max(0, y + parentBounds.y); win.setLocation(x, y); }
From source file:org.pentaho.reporting.engine.classic.demo.ancient.demo.layouts.internalframe.InternalFrameDemoFrame.java
/** * Handler method called by the preview action. This method should perform all operations to preview the report. *///from ww w. jav a2s .co m protected void attemptPreview() { final JInternalFrame frame = findSelectedFrame(); if (frame == null) { return; } final Rectangle bounds = frame.getBounds(); final Container parent = frame.getParent(); final boolean visible = frame.isVisible(); final int layer = frame.getLayer(); // now print .. previewReport(frame); if (parent != null) { if (frame.getParent() != parent) { frame.getParent().remove(frame); parent.add(frame); } } frame.setBounds(bounds); frame.setVisible(visible); frame.setLayer(new Integer(layer)); }