判断ImageIcon创建成功

                ImageIcon imageIcon = new ImageIcon(file.getPath());
                if(imageIcon.getImageLoadStatus() == MediaTracker.COMPLETE) {
                     editTP.insertIcon(new ImageIcon(file.getPath()));
                } else {
                    // 图像加载失败, igonre
                }
原文地址:https://www.cnblogs.com/cuizhf/p/2185844.html