/Users/lyon/j4p/src/j2d/FilePanel.java

1    /* 
2     * Created by DocJava, Inc. 
3     * User: lyon 
4     * Date: Mar 2, 2003 
5     * Time: 5:12:56 PM 
6     */ 
7    package j2d; 
8     
9    import j2d.animation.GifUtils; 
10   import bookExamples.ch26Graphics.draw2d.DrawTest; 
11   import gui.run.RunButton; 
12   import j2d.hpp.InvertFilter; 
13   import j2d.animation.GifUtils; 
14    
15   import javax.swing.*; 
16   import java.awt.*; 
17    
18   public class FilePanel 
19           extends JPanel { 
20    
21       ImageProcessListener ipl = null; 
22       DrawTest dt = null; 
23    
24       JPanel getButtonControlPanel() { 
25           JPanel bcp = new JPanel(); 
26           bcp.setLayout(new FlowLayout()); 
27           bcp.add(new RunButton("[open") { 
28               public void run() { 
29                   ipl.setImage(ImageUtils.getImage()); 
30               } 
31           }); 
32           bcp.add(new RunButton("open [gif animation") { 
33               public void run() { 
34                   Image img[] = GifUtils.getGifs(); 
35                   ipl.setImage(ImageUtils.getImage()); 
36               } 
37           }); 
38           bcp.add(new RunButton("o[riginal") { 
39               public void run() { 
40                   ipl.update(null); 
41               } 
42           }); 
43           bcp.add(new RunButton("[negate") { 
44               public void run() { 
45                   ipl.update(InvertFilter.getProcessor()); 
46               } 
47           }); 
48           bcp.add(new RunButton("setRO[I") { 
49               public void run() { 
50                   dt = 
51                           new DrawTest("set roi"); 
52                   dt.setImage(ipl.getImage()); 
53                   dt.setVisible(true); 
54               } 
55           }); 
56           bcp.add(new RunButton("getROI") { 
57               public void run() { 
58                   if (dt == null) return; 
59                   System.out.println( 
60                           dt.getRoi()); 
61               } 
62           }); 
63           return bcp; 
64       } 
65    
66       FilePanel(ImageProcessListener _ipl) { 
67           ipl = _ipl; 
68           setLayout(new BorderLayout()); 
69           add(getButtonControlPanel(),BorderLayout.CENTER); 
70    
71       } 
72    
73   } 
74