Update the panel's absolute screen coordinates whenever the component is

moved or resized, in addition to when it is laid out.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1630 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2002-08-08 20:16:07 +00:00
parent 0e86592ca7
commit c671f5a1c8
@@ -1,5 +1,5 @@
//
// $Id: VirtualMediaPanel.java,v 1.7 2002/07/02 23:15:53 shaper Exp $
// $Id: VirtualMediaPanel.java,v 1.8 2002/08/08 20:16:07 shaper Exp $
package com.threerings.media;
@@ -9,6 +9,8 @@ import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent;
import javax.swing.SwingUtilities;
@@ -35,6 +37,19 @@ public class VirtualMediaPanel extends MediaPanel
public VirtualMediaPanel (FrameManager framemgr)
{
super(framemgr);
// keep an eye on any movement or resizing of the panel so that we
// can track our absolute screen coordinates to work around the
// Windows copyArea() bug
addComponentListener(new ComponentAdapter() {
public void componentMoved (ComponentEvent e) {
findRootBounds();
}
public void componentResized (ComponentEvent e) {
findRootBounds();
}
});
}
/**
@@ -140,6 +155,18 @@ public class VirtualMediaPanel extends MediaPanel
// we need to obtain our absolute screen coordinates to work
// around the Windows copyArea() bug
findRootBounds();
}
/**
* Determines the absolute screen coordinates at which this panel is
* located and stores them for reference later when rendering. This
* is necessary in order to work around the Windows
* <code>copyArea()</code> bug.
*/
protected void findRootBounds ()
{
_abounds.setLocation(0, 0);
FrameManager.getRoot(this, _abounds);
}