/Users/lyon/j4p/src/j2d/edge/gabor/MartelliView.java

1    package j2d.edge.gabor; 
2     
3    import gui.run.RunButton; 
4    import gui.run.RunSlider; 
5    import ip.martelli.MartelliParams; 
6     
7    import javax.swing.*; 
8    import java.awt.*; 
9     
10    
11   public class MartelliView { 
12       MartelliParams mp = null; 
13    
14       public MartelliView(MartelliParams _mp) { 
15           mp = _mp; 
16           init(); 
17       } 
18    
19       java.awt.Container c = null; 
20    
21       public void init() { 
22           gui.ClosableJFrame cf = new gui.ClosableJFrame(); 
23           cf.setSize(200, 200); 
24           c = cf.getContentPane(); 
25           c.setLayout(new FlowLayout()); 
26           greedSlider(c); 
27           pixelSlider(c); 
28           plySlider(c); 
29    
30    
31           cf.setVisible(true); 
32       } 
33    
34       public void addRunButton(RunButton rb) { 
35           c.add(rb); 
36       } 
37    
38       private void plySlider(java.awt.Container c) { 
39           c.add(new RunSlider(0, 10, mp.getPly()) { 
40               public void run() { 
41                   mp.setPly(getValue()); 
42               } 
43           }, BorderLayout.CENTER); 
44           c.add(new JLabel("Ply"), BorderLayout.WEST); 
45       } 
46    
47       private void pixelSlider(java.awt.Container c) { 
48           c.add(new RunSlider(0, 10, mp.getPixel()) { 
49               public void run() { 
50                   mp.setGreediness(getValue()); 
51               } 
52           }, BorderLayout.CENTER); 
53           c.add(new JLabel("Pixel"), BorderLayout.WEST); 
54       } 
55    
56       private void greedSlider(java.awt.Container c) { 
57           c.add(new RunSlider(0, 10, mp.getGreediness()) { 
58               public void run() { 
59                   mp.setGreediness(getValue()); 
60               } 
61           }, BorderLayout.CENTER); 
62           c.add(new JLabel("Greed"), BorderLayout.WEST); 
63       } 
64    
65    
66   }