Methods Summary |
---|
private java.awt.Rectangle | computeGrabRect()
// width, height are size of this comp / zoom
int grabWidth = (int) ((double) mySize.width / zoom);
int grabHeight = (int) ((double) mySize.height / zoom);
// upper left corner is current point
return new Rectangle (point.x, point.y, grabWidth, grabHeight);
|
public java.awt.Dimension | getMaximumSize() return mySize;
|
public java.awt.Dimension | getMinimumSize() return mySize;
|
public java.awt.Dimension | getPreferredSize() return mySize;
|
public void | mouseDragged(java.awt.event.MouseEvent e)
mouseMoved (e);
|
public void | mouseMoved(java.awt.event.MouseEvent e)
Point offsetPoint = comp.getLocationOnScreen();
e.translatePoint (offsetPoint.x, offsetPoint.y);
point = e.getPoint();
repaint();
|
public void | paint(java.awt.Graphics g)
if ((robot == null) || (point.x == -1))
{
g.setColor (Color.blue);
g.fillRect (0, 0, mySize.width, mySize.height);
return;
}
Rectangle grabRect = computeGrabRect();
BufferedImage grabImg = robot.createScreenCapture (grabRect);
Image scaleImg =
grabImg.getScaledInstance (mySize.width, mySize.height, Image.SCALE_FAST);
g.drawImage (scaleImg, 0, 0, null);
|