/Users/lyon/j4p/src/ip/gui/frames/FilterFrame.java

1    package ip.gui.frames; 
2     
3    import ip.transforms.Kernels; 
4    import j2d.ImageUtils; 
5     
6    import java.awt.*; 
7    import java.awt.event.ActionEvent; 
8     
9    public class FilterFrame extends ImageFrame { 
10    
11       Menu filterMenu = getMenu("Filter"); 
12    
13       Menu rgbMenu = getMenu("RGBto"); 
14       MenuItem gray_mi = 
15               addMenuItem(rgbMenu, "[E-g]ray"); 
16       MenuItem blurFast_mi = 
17               addMenuItem(rgbMenu, "blurFast"); 
18    
19       public void actionPerformed(ActionEvent e) { 
20           if (match(e, gray_mi)) { 
21               gray(); 
22               return; 
23           } 
24           if (match(e, blurFast_mi)) { 
25               blurFast(); 
26               return; 
27           } 
28           super.actionPerformed(e); 
29       } 
30    
31       public void blurFast() { 
32           convolveFast(Kernels.getHat13()); 
33       } 
34    
35       public void convolveFast(float k[][]) { 
36           setImage(ImageUtils.convolution(getImage(), k)); 
37           super.image2Short(); 
38           repaint(); 
39       } 
40    
41       public void gray() { 
42           shortImageBean.gray(); 
43           short2Image(); 
44       } 
45    
46       public FilterFrame(String title) { 
47           super(title); 
48           MenuBar menuBar = getMenuBar(); 
49           filterMenu.add(rgbMenu); 
50           menuBar.add(filterMenu); 
51           setMenuBar(menuBar); 
52           //filterMenu.addActionListener(this); 
53           //rgbMenu.addActionListener(this); 
54       } 
55    
56       public static void main(String args[]) { 
57           new FilterFrame("FilterFrame"); 
58       } 
59   } 
60    
61    
62    
63    
64