public Dimension getSize() { return internalFrame.getSize(); }
public Dimension getSize() { if(useDesktop) { return jInternalFrame.getSize(); } else { return jFrame.getSize(); } }
private void ensureMinWidthAndHight(JInternalFrame frame, int minWidth, int minHeight) { final Dimension frameSize = frame.getSize(); final int correctedWidth = Math.max(frameSize.width, minWidth); final int correctedHeight = Math.max(frameSize.height, minHeight); frame.setSize(new Dimension(correctedWidth, correctedHeight)); }
public void center() { if(useDesktop) { Dimension s = desktopFrame.getSize(); Dimension id = jInternalFrame.getSize(); jInternalFrame.setLocation(s.width/2 - id.width/2, s.height/2 - id.height/2); } else { jFrame.setLocationRelativeTo(null); } }
public void moveFrame() { JInternalFrame selectedFrame = desktopPane.getSelectedFrame(); Dimension currentSize = selectedFrame.getSize(); try { selectedFrame.setMaximum(false); } catch (PropertyVetoException ex) { ex.printStackTrace(); } selectedFrame.setSize(currentSize); desktopPane.remove(selectedFrame); desktopPane.repaint(); secondFrame.addInternalFrame(selectedFrame); }
public void setSize(int width, int height) { Dimension old = internalFrame.getSize(); Dimension size = new Dimension(width, height); if (old.equals(size)) return; internalFrame.setSize(size); firePropertyChangeEvent("size", old, size); }
JDesktopPane mainPanel; JInternalFrame jif_test = new JInternalFrame(); public void centerJIF(JInternalFrame jif) { Dimension desktopSize = mainPanel.getSize(); Dimension jInternalFrameSize = jif.getSize(); int width = (desktopSize.width - jInternalFrameSize.width) / 2; int height = (desktopSize.height - jInternalFrameSize.height) / 2; jif.setLocation(width, height); jif.setVisible(true); }
void select(final JInternalFrame frame) { frame.setVisible(true); try { if (frame.isIcon()) { frame.setIcon(false); } else { frame.setSelected(true); } } catch (final PropertyVetoException ex) { ex.printStackTrace(); } final Dimension size = getDesktopPane().getSize(); final Dimension s = frame.getSize(); final Point p = frame.getLocation(); final int x = Math.max(Math.min(p.x - (p.x + s.width - size.width), p.x), 0); final int y = Math.max(Math.min(p.y - (p.y + s.height - size.height), p.y), 0); if (x != p.x || y != p.y) { frame.setLocation(x, y); } final int width = Math.min(s.width, size.width); final int height = Math.min(s.height, size.height); if (width < s.width || height < s.height) { frame.setSize(width, height); } }
public void run() { Container cp = getParent(); if ((cp instanceof JViewport) && (_f != null) && _f.isShowing()) { JViewport vp = (JViewport) cp; Point vo = vp.getViewPosition(); Dimension es = vp.getExtentSize(); Dimension vs = vp.getViewSize(); Point fo = _f.getLocation(); Dimension fs = _f.getSize(); if (fo.x < vo.x) vo.x = fo.x; if (fo.y < vo.y) vo.y = fo.y; if (fo.x + fs.width > vo.x + es.width) vo.x = Math.min(fo.x, vs.width - es.width); if (fo.y + fs.height > vo.y + es.height) vo.y = Math.min(fo.y, vs.height - es.height); vp.setViewPosition(vo); } } };
JInternalFrame frame = (JInternalFrame) obj; Rectangle visible = OVTK2Desktop.getInstance().getDesktopPane().getVisibleRect(); Dimension size = frame.getSize(); frame.setLocation((visible.width / 2) - (size.width / 2), (visible.height / 2) - (size.height / 2)); if (size.height > visible.height)
Dimension size = internal.getSize(); internal.setLocation((visible.width / 2) - (size.width / 2), (visible.height / 2) - (size.height / 2)); Dimension size = internal.getSize(); internal.setLocation(0, visible.height - size.height); Dimension size = internal.getSize(); internal.setLocation(visible.width - size.width, (int) max.getY()); Dimension size = internal.getSize(); internal.setLocation(visible.width - size.width, visible.height - size.height);
private void rangerInternalFrames() { final JInternalFrame[] ifs = getAllInternalFrames(); boolean done = false; final JComponent pn = getMainPanel().getMiddleComponent(); final Dimension pnDim = (pn instanceof JScrollPane) ? ((JScrollPane) pn).getViewport().getExtentSize() : pn .getSize(); if (ifs != null) { for (int i = ifs.length - 1; i >= 0; i--) { if (!BuLib.isPalette(ifs[i])) { final Dimension d = ifs[i].getSize(); final Point loc = ifs[i].getLocation(); if (((loc.x + d.width) > pnDim.width) || ((loc.y + d.height) > pnDim.height)) { d.width = Math.min(d.width, pnDim.width); d.height = Math.min(d.height, pnDim.height); loc.x = 0; loc.y = 0; ifs[i].setSize(d); ifs[i].setLocation(loc); done = true; } } } } if (done) { getMainPanel().arrangePalettes(); } }
public void checkInternalFrame(JInternalFrame _f) { if (!SwingUtilities.isEventDispatchThread()) throw new RuntimeException("Not in swing thread."); Dimension dd = getSize(); Point pf = _f.getLocation(); Dimension df = _f.getSize(); if (_f.isResizable()) { if (df.width > dd.width) df.width = dd.width; if (df.height > dd.height) df.height = dd.height; if (!df.equals(getSize())) _f.setSize(df); } if (pf.x + df.width > dd.width) pf.x = dd.width - df.width; if (pf.y + df.height > dd.height) pf.y = dd.height - df.height; if (pf.x < 0) pf.x = 0; if (pf.y < 0) pf.y = 0; if (isTabbed() && isPalette(_f) && (pf.x < LEFT_MARGIN + 4)) pf.x = LEFT_MARGIN + 4; if (!pf.equals(getLocation())) _f.setLocation(pf); adjustSize(); }
/** * Adds a given JInternalFrame to the desktop and centers it. * * @param internal * JInternalFrame to be displayed centered */ protected void displayCentered(JInternalFrame internal) { // do the location calculation Rectangle visible = this.getDesktopPane().getVisibleRect(); Dimension size = internal.getSize(); internal.setLocation((visible.width / 2) - (size.width / 2), (visible.height / 2) - (size.height / 2)); // add to desktop and show this.getDesktopPane().add(internal); internal.setVisible(true); internal.toFront(); }
if (cp instanceof JViewport) { Rectangle vr = ((JViewport) cp).getViewRect(); Dimension df = _f.getSize();
th = frame.getSize().height - frame.getRootPane().getSize().height - fh - 1; if (frame.getJMenuBar() != null) { th -= frame.getJMenuBar().getSize().height;
Dimension cs = dti.getSize();
Dimension size = internalFrame.getSize();
frames[i].setLocation(p); Dimension d = frames[i].getSize(); if (p.x + d.width > r.width) r.width = p.x + d.width; if (p.y + d.height > r.height) r.height = p.y + d.height;