title: How to handle multi resolution images in slideshow?
body: <p>I am use this code for the slideshow, and it's working 100%, but the problem is the image resolution if the resolution was high no problem but if it was low the image is shown in very bad shape.</p>
  
  <p>and the code is :</p>
  
  <pre><code>public class EasyView_V1 {
       public static Timer tm = null;
  
       public static File[] f = new File("C:/Ma7moud/my projects/Rami/NetBeans/Web applications/TheChatServerApp_3/web/images/brugges2006/big").listFiles();
  
       public static void main(String[] args) {
           JPanel panel5 = new JPanel();
           JLabel pic = new JLabel();
  
           pic.setSize(new Dimension(610, 695));
  
           //Call The Function SetImageSize
           try {
               SetImageSize(f.length - 1, f, pic);
           } catch (Exception e) {
               System.out.println(e.toString());
               JOptionPane.showMessageDialog(null, "Images directory not found", "Error", JOptionPane.ERROR_MESSAGE);
               JOptionPane.showMessageDialog(null, "Plz check the images directory and try again", "Attention", JOptionPane.INFORMATION_MESSAGE);
               System.exit(1);
           }
  
           try {
               //set a timer
               tm = new Timer(1000, (ActionEvent e) -&gt; {
               SetImageSize(x, f, pic);
               x += 1;
               try {
                   if (x &gt;= f.length) {
                       x = 0;
                   }
               } catch (Exception ex) {
                   System.out.println(ex.toString());
                   System.exit(1);
               }
           });
         } catch (Exception e) {
              System.out.println(e.toString());
         }
  
      panel5.add(pic);
      tm.start();
      JFrame f = new JFrame ()
      f.add(panel5);
      f.pack();
      f.setVisible(true);
  }
  </code></pre>
  
  <p>Here is the code for image drawing:</p>
  
  <pre><code>public static void SetImageSize(int i, File[] f, JLabel pic) {
      try {
          ImageIcon icon = new ImageIcon(f[i].toString());
          Image img = icon.getImage();
          @SuppressWarnings("UnusedAssignment")
          Image newImg = null;
  
          newImg = img.getScaledInstance(pic.getWidth(), pic.getHeight(), Image.SCALE_SMOOTH);
  
          ImageIcon newImc = new ImageIcon(newImg);
          pic.setIcon(newImc);
      } catch (Exception ex) {
          System.out.println(ex.toString());
      }
  }
  }
  </code></pre>