import java.awt.*;
import javax.swing.*;

public class ImageDisplay extends JFrame {
   /**
    * Creates a window and displays an image in it
    * @param imageFile a file with the image (.png or .jpg)
    * @param width  window width
    * @param height window height
    * @param x x-position of upper left corner
    * @param y y-position of upper left corner
    */
   public ImageDisplay(String imageFile, int width, int height, int x, int y) {
      setLocation(x, y);
      ImageIcon icon = new ImageIcon(imageFile);
      JLabel label = new JLabel(icon);
      add(label);
      setPreferredSize(new Dimension(width, height));
      pack();
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setVisible(true);
   }

   /**
    * Demonstration program.
    */
   public static void main(String[] args) {
      new ImageDisplay("images/Matterhorn-800.jpg", 850, 600, 0, 0);
   }
}