/Users/lyon/j4p/src/j2d/hpp/ThresholdPanel.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.RunSlider; 
10   import j2d.ImageProcessListener; 
11    
12   import javax.swing.*; 
13   import java.awt.*; 
14    
15   public class ThresholdPanel 
16           extends JPanel { 
17    
18       private double threshold = 0; 
19       ImageProcessListener ipl = null; 
20    
21    
22       public ThresholdPanel(ImageProcessListener _ipl) { 
23           ipl = _ipl; 
24    
25           setLayout(new GridLayout(3, 0)); 
26    
27           add(new RunSlider(0, 255) { 
28               public void run() { 
29                   threshold = getValue(); 
30                   updateImage(); 
31               } 
32           }); 
33    
34       } 
35    
36       private void updateImage() { 
37           ThresholdProcessor cf = new ThresholdProcessor(threshold); 
38           ipl.update(new HppFilterImageProcessor(cf)); 
39    
40       } 
41    
42   } 
43