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);
精彩评论