我有一个Jtree节点代表图像,用户可以调用和查看。有时需要将图像加载四到五秒钟。理想情况下,我希望在用户正在等待时显示等待光标,并选择树中选定的节点。然而,我发现用户点击节点,没有任何事情发生,然后出现图像,然后选择节点(等待光标从不出现或更可能出现非常短暂,然后立即消失,我试图重新绘制树和applet,试图强制行为按我想要的顺序发生。到目前为止,我还没有碰到任何问题。问题:秋千更新拼图
thisApplet.setCursor(new Cursor(Cursor.WAIT_CURSOR));
selectdocumentTreeLeaf(); // a JTree with nodes representing images
tree.repaint();
thisApplet.repaint();
tree.setEnabled(false); //disabled so users don't keep clicking on it.
result = createImage(queue.q[pointer].currentPage); //where the image is fetched
thisApplet.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
有没有可能在加载图像时阻塞主Swing线程?图像加载代码是否在组件的paint方法中? – Pace 2011-02-09 04:59:55