下面的法典为什么显示黑人形象而不是形象? 如何适当推广布赖迪奇?
class SizeOfImage {
public static void main(String[] args) throws Exception {
URL url = new URL("http://cloudbite.co.uk/wp-content/uploads/2011/03/google-chrome-logo-v1.jpg");
final BufferedImage bi = ImageIO.read(url);
final String size = bi.getWidth() + "x" + bi.getHeight();
final CustomImg cstImg = new CustomImg(bi.getWidth(), bi.getHeight(), bi.getType());
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JLabel l = new JLabel(size, new ImageIcon(cstImg), SwingConstants.RIGHT);
JOptionPane.showMessageDialog(null, l);
}
});
}
public static class CustomImg extends BufferedImage {
public CustomImg(int width, int height, int type){
super(width, height, type);
}
}
}