public void paintIcon(final Component c, Graphics g, int x, int y) {
// TODO Auto-generated method stub
if (isIconCreated) {
realIcon.paintIcon(c, g, x, y);
g.drawString("随便找了一幅画", x + 20, y + 370);
} else {
g.drawRect(x, y, width - 1, height - 1);
g.drawString("画正在加载", x + 20, y + 20);
}
//图像在另外个线程中被加载
synchronized (this) {
SwingUtilities.invokeLater(new Runnable(){ public void run() {
// TODO Auto-generated method stub
try {
//减缓图像加载过程
Thread.currentThread().sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
realIcon = new ImageIcon(imageName);
isIconCreated = true;
//图像加载后,重新描绘视窗构件
c.repaint();
}

});
}
}红色部分有疑惑
为什么那个finally不加会抱错?