public void loadImage(File f) throws IOException {
  if (f == null || !f.exists()) {
    thumbnail=null;
  }
 else {
    final ImageIcon icon=readCompatibleImageIcon(f);
    if (icon == null) {
      thumbnail=null;
    }
 else {
      dimension=icon.getIconWidth() + " x " + icon.getIconHeight();
      int width=icon.getIconWidth();
      int height=icon.getIconHeight();
      if (height > 75) {
        width=width * 75 / height;
        height=75;
      }
      if (width > 90) {
        height=height * 90 / width;
        width=90;
      }
      BufferedImage image=(BufferedImage)icon.getImage();
      image=(BufferedImage)MSwingUtilities.getScaledInstance(image,width,height);
      thumbnail=new ImageIcon(image);
    }
  }
}

public void loadImage ( File f ) throws IOException { if ( f == null || ! f . exists ( ) ) { thumbnail = null ; } else { final ImageIcon icon = readCompatibleImageIcon ( f ) ; if ( icon == null ) { thumbnail = null ; } else { dimension = icon . getIconWidth ( ) + " x " + icon . getIconHeight ( ) ; int width = icon . getIconWidth ( ) ; int height = icon . getIconHeight ( ) ; if ( height > 75 ) { width = width * 75 / height ; height = 75 ; } if ( width > 90 ) { height = height * 90 / width ; width = 90 ; } BufferedImage image = ( BufferedImage ) icon . getImage ( ) ; image = ( BufferedImage ) MSwingUtilities . getScaledInstance ( image , width , height ) ; thumbnail = new ImageIcon ( image ) ; } } }
charge le fichier si c ' est une image .
