package awb; import java.awt.*; /* ImageViewer Class * Eric Jewart * * This class implements a standalone window that * displays a Picture object (see Picture.java). */ public class ImageViewer extends Frame { private Picture myPicture; public ImageViewer(Picture p, String t) { super("Image Viewer [" + t + "]"); myPicture = p; show(); pack(); } public Dimension preferredSize() { return new Dimension(myPicture.getRealWidth(), myPicture.getRealHeight()); } public Dimension minimumSize() { return new Dimension(myPicture.getRealWidth(), myPicture.getRealHeight()); } public void paint(Graphics g) { myPicture.drawFull(g,0,0,this); } public boolean handleEvent(Event e) { if (e.id == Event.WINDOW_DESTROY) { this.hide(); this.dispose(); return true; } return super.handleEvent(e); } }