/Users/lyon/j4p/src/j2d/hpp/HistogramPanel.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.hpp; 
8     
9    import gui.run.RunButton; 
10   import gui.run.RunSlider; 
11   import j2d.ImageProcessListener; 
12    
13   import javax.swing.*; 
14   import java.awt.*; 
15    
16   public class HistogramPanel 
17           extends JPanel { 
18    
19       ImageProcessListener ipl = null; 
20    
21    
22       public HistogramPanel(ImageProcessListener _ipl) { 
23           ipl = _ipl; 
24    
25           setLayout(new FlowLayout()); 
26           add(new RunButton("unahe") { 
27               public void run() { 
28                   updateImage(); 
29               } 
30           }); 
31           add(new RunSlider(1, 100, 50) { 
32               public void run() { 
33                   enahe(getValue()); 
34               } 
35           }); 
36    
37       } 
38    
39       private void enahe(double alpha) { 
40           EnaheFilter e = new EnaheFilter(ipl.getImage(), alpha / 10.0); 
41           ipl.update(new HppFilterImageProcessor(e)); 
42       } 
43    
44       private void updateImage() { 
45           EqualizationFilter cf = new EqualizationFilter( 
46                   ipl.getImage()); 
47           ipl.update(new HppFilterImageProcessor(cf)); 
48    
49       } 
50    
51   } 
52