package yi.iu.ui;

import java.awt.Frame;
import java.awt.Image;
import java.awt.event.*;

/**
 * Frame to display the image
 *
 * @author Yi Li
 * @version 1.0
 */

public class ImageFrame extends Frame{
  /**
   * Image Panel to display the image
   */
  ImagePanel m_imagePanel;

  public ImageFrame(Image image) {
    m_imagePanel = new ImagePanel(image);
    init();
  }

  public ImageFrame(Image image, int width, int height) {
    m_imagePanel = new ImagePanel(image, width, height);
    init();
  }

  public ImageFrame(int[] data, int width, int height) {
    m_imagePanel = new ImagePanel(data, width, height);
    init();
  }

  void init() {
    add(m_imagePanel);
    this.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    });
  }
}