/Users/lyon/j4p/src/j2d/hpp/ThresholdFilter3Panel.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 j2d.ImageUtils; 
10   import gui.run.RunSlider; 
11   import j2d.ImageProcessListener; 
12    
13   import javax.swing.*; 
14   import java.awt.*; 
15    
16    
17   public class ThresholdFilter3Panel 
18           extends JPanel { 
19       private float ar = 1; 
20       private float ag = 1; 
21       private float ab = 1; 
22       ImageProcessListener ipl = null; 
23    
24    
25       public ThresholdFilter3Panel(ImageProcessListener _ipl) { 
26           ipl = _ipl; 
27    
28           setLayout(new FlowLayout()); 
29           add(new RunSlider(1, 255, 50) { 
30               public void run() { 
31                   ar = scaleSlider(getValue()); 
32                   updateImage(); 
33               } 
34           }); 
35       } 
36    
37       private void updateImage() { 
38           ipl.update(new Threshold3Processor(ar)); 
39       } 
40    
41       public static float scaleSlider(int t) { 
42           return (float) (t); 
43       } 
44   } 
45