public Point getLocation() { return internalFrame.getLocation(); }
@Override public void mouseReleased(MouseEvent e) { final Point originalPoint = iframe.getLocation(); if (originalPoint.y < 0) iframe.setLocation(originalPoint.x, 0); } });
public Point getLocation() { if(useDesktop) { return jInternalFrame.getLocation(); } else { return jFrame.getLocation(); } }
if(jif.getClass().equals(intFrameClass)) targetFrame = jif; if(jif.getLocation().x > xoff) xoff = jif.getLocation().x; if(jif.getLocation().y > yoff) yoff = jif.getLocation().y;
public void setLocation(int x, int y) { Point old = internalFrame.getLocation(); Point location = new Point(x, y); if (old.equals(location)) return; internalFrame.setLocation(location); firePropertyChangeEvent("location", old, location); }
private void setPosition(final JInternalFrame frame) { final Point location = frame.getLocation(); if (location.getX() == 0 && location.getY() == 0) { final int length = getAllFrames().length; final int y = length * 20; int x; if (SwingUtility.isLeftOrientation()) { x = length * 20; } else { final int width = frame.getContentPane().getPreferredSize().width; x = (int) (getSize().getWidth() - length * 20) - width; } System.out.println("X=" + x); System.out.println("Y=" + y); System.out.println(frame.getContentPane().getPreferredSize()); frame.setLocation(x, y); } }
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); } } };
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); } }
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 Component add(JInternalFrame frame) { JInternalFrame[] array = getAllFrames(); Point p; Component retval = super.add(frame); checkDesktopSize(); if (array.length > 0) { p = array[0].getLocation(); p.x = p.x + FRAME_OFFSET; p.y = p.y + FRAME_OFFSET; } else { p = new Point(0, 0); } frame.setLocation(p.x, p.y); moveToFront(frame); frame.setVisible(true); try { frame.setSelected(true); } catch (PropertyVetoException e) { frame.toBack(); } return retval; }
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(); }
/** * Sets the Shaded attribute of the InternalFrameWindow object * * @param b The new Shaded value */ public void setShaded(boolean b) { if (b == shaded) { return; } if (b == true) { Rectangle bounds = frame.getBounds(); Rectangle p = new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); frame.putClientProperty(SHADE_BOUNDS_PROPERTY, p); frame.setBounds(p.x, p.y, p.width, frame.getMinimumSize().height - 2); } else { Point location = frame.getLocation(); Rectangle p = (Rectangle)frame.getClientProperty(SHADE_BOUNDS_PROPERTY); frame.getDesktopPane().getDesktopManager().setBoundsForFrame(frame, location.x, location.y, p.width, p.height); frame.putClientProperty(SHADE_BOUNDS_PROPERTY, null); } shaded = b; }
x = refFrame.getLocation().x + 20; y = refFrame.getLocation().y + 20;
internal.setLocation(visible.width - size.width, (int) max.getY()); locations.put(internal, internal.getLocation());
fr.getLocation(loc_); loc_.x -= 5; loc_.y -= 5;
Point pf = _f.getLocation(); if ((pf.x == 0) && (pf.y == 0)) { Container cp = getParent();
x = refFrame.getLocation().x + 20; y = refFrame.getLocation().y + 20;
if (frames[i].isIcon()) q = frames[i].getDesktopIcon().getLocation(); else q = frames[i].getLocation(); if (qmin.x > q.x) qmin.x = q.x; if (qmin.y > q.y) qmin.y = q.y; Point p = frames[i].getLocation(); p.x -= qmin.x; p.y -= qmin.y;
canvas.putClientProperty("shadow", true); canvas.setSize(c.getSize()); canvas.setLocation(c.getLocation());