之前没有这样做过,所以显然我很沮丧.这里,当前鼠标位置周围的64个像素在表单上绘制得更大.问题是,它有点'缓慢',我不知道从哪里开始修复.
除此之外,我创建了一个线程,它在完成后不断调用更新图形,并且像文本一样点fps,以显示事物的绘制速度.
图像示例:(图像来自Eclipse中的字母'a')

代码示例:
@SuppressWarnings("serial")
public static class AwtZoom extends Frame {
private BufferedImage image;
private long timeRef = new Date().getTime();
Robot robot = null;
public AwtZoom() {
super("Image zoom");
setLocation(new Point(640, 0));
setSize(400, 400);
setVisible(true);
final Ticker t = new Ticker();
this.image = (BufferedImage) (this.createImage(320, 330));
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
t.done();
dispose();
}
});
try {
robot = new Robot();
} catch (AWTException e) {
e.printStackTrace();
}
t.start();
}
private class Ticker extends Thread { …Run Code Online (Sandbox Code Playgroud)