Answer:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.*;
import java.awt.image.*;

class FromBoard extends Canvas implements MouseMotionListener, MouseListener {
   Image bgimage;
   Graphics bggraphics;
   Image image;

   int x,y;          // upper left corner of image
   int xdiff, ydiff;
   boolean moving;

   FromBoard () {
      int w = 100;
      int h = 100;
      int pix[] = new int[w * h];
      int index = 0;
      for (int y = 0; y < h; y++) {
         int red = (y * 255) / (h - 1);
         for (int x = 0; x < w; x++) {
            int blue = (x * 255) / (w - 1);
            pix[index++] = (255 << 24) | (red << 16) | blue;
         }
      }
      image = createImage(new MemoryImageSource(w, h, pix, 0, w));

      x = y = 320 - 50;  // Center the image
      setSize(640,640);
      setVisible(true);
      moving = false;
      addMouseListener(this);
      addMouseMotionListener(this);
   }

   public void setImage() {
      bgimage = createImage(640,640);    // Double buffering
      bggraphics = bgimage.getGraphics();
   }

   public void paint(Graphics g) {
      if (bggraphics == null) return;
      bggraphics.setColor(Color.gray);
      bggraphics.fillRect(0,0,640,640);
      bggraphics.drawImage(image,x,y,this);
      g.drawImage(bgimage, 0, 0, this);
   }

   public void mouseDragged (MouseEvent evt) {
      if (moving) {
         x = evt.getX()+xdiff;
         y = evt.getY()+ydiff;
         paint(this.getGraphics());
      }
   }

   public void mouseMoved (MouseEvent evt) {  }

   public void mousePressed (MouseEvent evt) { 
      if (x < evt.getX() && evt.getX() < x+100 &&
          y < evt.getY() && evt.getY() < y+100) {
         moving = true;
         xdiff = x-evt.getX();
         ydiff = y-evt.getY();
      }
   }

   public void mouseReleased (MouseEvent evt) { moving = false; }
   public void mouseClicked (MouseEvent evt) {}
   public void mouseEntered (MouseEvent evt) {}
   public void mouseExited (MouseEvent evt) {}
}

class Boxy extends JFrame {
   FromBoard board;

   public Boxy () { 
      getContentPane().setLayout(new BorderLayout());
      getContentPane().add("Center", board = new FromBoard());
   }

   public void draw () {  board.paint(board.getGraphics());  }

   public void setImage () { board.setImage(); }
}

public class EmbedImageFromArray extends Applet {
   public void init () {
      Boxy boxy = new Boxy();
      boxy.setSize(700,700);
      boxy.setVisible(true);
      boxy.setImage();
      boxy.draw();
   }
}