开发者

Error message for failed new ImageIcon(url)

I try to load an image with:

ImageIcon imageIcon 开发者_StackOverflow社区= new ImageIcon(url);

if I query the load status: imageIcon.getImageLoadStatus(); it returns MediaTracker.ERRORED

Is there a way to get an error message saying what the problem was?


You can try loading the image via alternate methods. That might give you better feedback:

Image img = ImageIO.read(url);
ImageIcon icon = new ImageIcon(img);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜