/Users/lyon/j4p/src/gui/PseudoColorController.java

1    /* 
2     * Created by DocJava, Inc. 
3     * User: lyon 
4     * Date: Mar 2, 2003 
5     * Time: 5:12:56 PM 
6     */ 
7    package gui; 
8     
9    import gui.run.RunSlider; 
10    
11   import javax.swing.*; 
12   import java.awt.*; 
13    
14   public class PseudoColorController 
15           extends JPanel { 
16       private double ar = 0.01; 
17       private double ag = 0.01; 
18       private double ab = 0.01; 
19    
20    
21       PseudoColorController(final IconUtils.OpenImageButton pseudoColorButton) { 
22    
23           setLayout(new GridLayout(3, 0)); 
24           add(new RunSlider() { 
25               public void run() { 
26                   ar = scaleSlider(getValue()); 
27                   IconUtils.updateImage(ar, ag, ab, pseudoColorButton); 
28               } 
29           }); 
30           add(new RunSlider() { 
31               public void run() { 
32                   ag = scaleSlider(getValue()); 
33                   IconUtils.updateImage(ar, ag, ab, pseudoColorButton); 
34               } 
35           }); 
36           add(new RunSlider() { 
37               public void run() { 
38                   ab = scaleSlider(getValue()); 
39                   IconUtils.updateImage(ar, ag, ab, pseudoColorButton); 
40               } 
41           }); 
42       } 
43    
44       public static double scaleSlider(int t) { 
45           return 0.49 * (t / 100.0) + 0.01; 
46       } 
47   } 
48