/Users/lyon/j4p/src/ip/hak/ImageMorph.java

1    package ip.hak; 
2     
3    import java.awt.*; 
4    import java.awt.event.ComponentEvent; 
5    import java.awt.event.ComponentListener; 
6    import java.awt.event.WindowEvent; 
7     
8    public class ImageMorph extends ip.gui.frames.ClosableFrame implements ComponentListener { 
9     
10       MyPanel mp; 
11    
12       public static void main(String args[]) { 
13           ImageMorph im = new ImageMorph("Image Morph Frame"); 
14           im.setVisible(true); 
15       } 
16    
17       public ImageMorph(String title) { 
18           super(title); 
19    
20           mp = new MyPanel(600, 400); 
21           add(mp); 
22           pack(); 
23           addComponentListener(this); 
24       } 
25    
26       public void componentResized(ComponentEvent e) { 
27           removeComponentListener(this); 
28           Dimension d = getSize(); 
29           if (d.width < 600 || d.height < 400) { 
30               mp.setSize(600, 400); 
31           } else { 
32               mp.setSize(d.width, d.height); 
33    
34           } 
35           pack(); 
36           mp.reLocate(); 
37           addComponentListener(this); 
38       } 
39    
40       public void windowClosing(WindowEvent e) { 
41           dispose(); 
42           System.exit(0); 
43       } 
44    
45    
46       public void componentMoved(ComponentEvent e) { 
47       } 
48    
49    
50       public void componentShown(ComponentEvent e) { 
51       } 
52    
53    
54       public void componentHidden(ComponentEvent e) { 
55       } 
56   }