/Users/lyon/j4p/src/j2d/gui/LinearMappingToolbox.java
|
1 // Glenn Josefiak
2 // Fairfield University
3 // SW513
4 // Spring 2003
5
6 package j2d.gui;
7
8 import gui.run.ObservableSliderBank;
9
10 import javax.swing.*;
11 import java.awt.*;
12
13 /**
14 * A JInternalFrame containing controls for brightness
15 * and contrast adjustment.
16 */
17 public class LinearMappingToolbox extends JInternalFrame {
18 private ObservableSliderBank sbkLMSliders;
19 private JButton btnACL; // automatic contrast control
20
21 /**
22 * Create a new LinearMappingToolbox
23 */
24 public LinearMappingToolbox() {
25 Container c;
26
27 sbkLMSliders = new ObservableSliderBank(2);
28 sbkLMSliders.setSliderLabel(0, "Brightness");
29 sbkLMSliders.setSliderRange(0, -200f, 200f);
30 sbkLMSliders.setTickLabel(0, -200f, "-200");
31 sbkLMSliders.setTickLabel(0, 0f, "0");
32 sbkLMSliders.setTickLabel(0, 200f, "200");
33
34 sbkLMSliders.setSliderLabel(1, "Contrast");
35 sbkLMSliders.setSliderRange(1, 0.2f, 5f);
36 sbkLMSliders.setTickLabel(1, 0.2f, "0.2");
37 sbkLMSliders.setTickLabel(1, 1f, "1");
38 sbkLMSliders.setTickLabel(1, 5f, "5");
39
40 btnACL = new JButton("Auto-adjust");
41
42 c = getContentPane();
43 c.setLayout(new BorderLayout());
44 c.add(sbkLMSliders, BorderLayout.CENTER);
45
46 JPanel x = new JPanel();
47 x.setLayout(new FlowLayout(FlowLayout.RIGHT));
48 x.add(btnACL);
49 c.add(x, BorderLayout.SOUTH);
50
51 setTitle("Linear Mapping");
52 pack();
53 setClosable(true);
54 setMaximizable(false);
55 setResizable(false);
56 }
57
58 /**
59 * Return a handle to the slider bank on the control panel.
60 *
61 * @return A reference to an ObservableSliderBank
62 */
63 public ObservableSliderBank getSliderBank() {
64 return sbkLMSliders;
65 }
66
67 /**
68 * Return a handle to the button on the control panel.
69 *
70 * @return A reference to a JButton.
71 */
72 public JButton getButton() {
73 return btnACL;
74 }
75 }
76