Revision 12127 trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/properties/panels/EnhancedBrightnessContrastPanel.java
EnhancedBrightnessContrastPanel.java | ||
---|---|---|
16 | 16 |
* along with this program; if not, write to the Free Software |
17 | 17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
18 | 18 |
*/ |
19 |
|
|
20 | 19 |
package org.gvsig.rastertools.properties.panels; |
21 | 20 |
|
22 | 21 |
import java.awt.BorderLayout; |
... | ... | |
33 | 32 |
import org.gvsig.gui.beans.slidertext.SliderTextContainer; |
34 | 33 |
|
35 | 34 |
import com.iver.andami.PluginServices; |
36 |
|
|
37 |
|
|
38 | 35 |
/** |
39 | 36 |
* Panel para los controles de brillo y contrase . |
40 | 37 |
* |
... | ... | |
45 | 42 |
private InternalPanel internalPanel = null; |
46 | 43 |
private JCheckBox active = null; |
47 | 44 |
private JCheckBox preview = null; |
48 |
|
|
45 |
|
|
49 | 46 |
/** |
50 | 47 |
* Panel con los controles deslizantes de brillo y contraste |
51 | 48 |
* |
... | ... | |
55 | 52 |
final private static long serialVersionUID = 0; |
56 | 53 |
protected SliderTextContainer brightness = null; |
57 | 54 |
protected SliderTextContainer contrast = null; |
58 |
|
|
55 |
|
|
59 | 56 |
/** |
60 | 57 |
* Contructor |
61 | 58 |
*/ |
... | ... | |
66 | 63 |
contrast.setBorder(PluginServices.getText(this, "contraste")); |
67 | 64 |
init(); |
68 | 65 |
} |
69 |
|
|
66 |
|
|
70 | 67 |
private void init(){ |
71 | 68 |
this.setLayout(new GridLayout(2, 1)); |
72 | 69 |
this.add(brightness); |
73 | 70 |
this.add(contrast); |
74 | 71 |
} |
75 |
|
|
72 |
|
|
76 | 73 |
/** |
77 | 74 |
* Activa o desactiva el control |
78 | 75 |
* @param enable true activa y false desactiva los controles del panel |
... | ... | |
81 | 78 |
brightness.setControlEnabled(enabled); |
82 | 79 |
contrast.setControlEnabled(enabled); |
83 | 80 |
} |
84 |
|
|
81 |
|
|
85 | 82 |
} |
86 |
|
|
83 |
|
|
87 | 84 |
/** |
88 | 85 |
* Contructor |
89 | 86 |
*/ |
... | ... | |
92 | 89 |
internalPanel = new InternalPanel(); |
93 | 90 |
initialize(); |
94 | 91 |
} |
95 |
|
|
92 |
|
|
96 | 93 |
private void initialize() { |
97 | 94 |
setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this, "brillo_y_contraste"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
98 | 95 |
setLayout(new BorderLayout()); |
... | ... | |
100 | 97 |
add(internalPanel, BorderLayout.CENTER); |
101 | 98 |
add(getPreview(), BorderLayout.SOUTH); |
102 | 99 |
getActive().addActionListener(this); |
103 |
|
|
100 |
|
|
104 | 101 |
} |
105 |
|
|
102 |
|
|
106 | 103 |
/** |
107 | 104 |
* Obtiene el check de activar |
108 | 105 |
* @return |
... | ... | |
115 | 112 |
} |
116 | 113 |
return active; |
117 | 114 |
} |
118 |
|
|
115 |
|
|
119 | 116 |
/** |
120 | 117 |
* Obtiene el check de previsualizaci?n |
121 | 118 |
* @return |
... | ... | |
127 | 124 |
} |
128 | 125 |
return preview; |
129 | 126 |
} |
130 |
|
|
127 |
|
|
131 | 128 |
/** |
132 | 129 |
* Activa o desactiva el control |
133 | 130 |
* @param enable true activa y false desactiva los controles del panel |
... | ... | |
137 | 134 |
this.getPreview().setEnabled(enabled); |
138 | 135 |
internalPanel.setControlEnabled(enabled); |
139 | 136 |
} |
140 |
|
|
137 |
|
|
141 | 138 |
/** |
142 | 139 |
* Obtiene el valor del brillo que hay seleccionado en el control |
143 | 140 |
* @return double que representa el contraste seleccionado. Puede hacerse un casting a entero ya que |
... | ... | |
146 | 143 |
public double getBrightnessValue(){ |
147 | 144 |
return internalPanel.brightness.getValue(); |
148 | 145 |
} |
149 |
|
|
146 |
|
|
150 | 147 |
/** |
151 | 148 |
* Obtiene el valor del contraste que hay seleccionado en el control |
152 | 149 |
* @return double que representa el contraste seleccionado. Puede hacerse un casting a entero ya que |
... | ... | |
155 | 152 |
public double getContrastValue(){ |
156 | 153 |
return internalPanel.contrast.getValue(); |
157 | 154 |
} |
158 |
|
|
155 |
|
|
159 | 156 |
/** |
160 | 157 |
* Asigna el valor del brillo al control |
161 | 158 |
* @param value |
... | ... | |
163 | 160 |
public void setBrightnessValue(double value){ |
164 | 161 |
internalPanel.brightness.setValue(value); |
165 | 162 |
} |
166 |
|
|
163 |
|
|
167 | 164 |
/** |
168 | 165 |
* Asigna el valor del contraste al control |
169 | 166 |
* @param value |
... | ... | |
171 | 168 |
public void setContrastValue(double value){ |
172 | 169 |
internalPanel.contrast.setValue(value); |
173 | 170 |
} |
174 |
|
|
171 |
|
|
175 | 172 |
/** |
176 | 173 |
* A?ade un listener para el slider de brillo |
177 | 174 |
* @param l ChangeListener |
... | ... | |
179 | 176 |
public void addBrightnessChangeListener(ChangeListener l){ |
180 | 177 |
internalPanel.brightness.addChangeListener(l); |
181 | 178 |
} |
182 |
|
|
179 |
|
|
183 | 180 |
/** |
184 | 181 |
* A?ade un listener para el slider de contraste |
185 | 182 |
* @param l ChangeListener |
... | ... | |
187 | 184 |
public void addContrastChangeListener(ChangeListener l){ |
188 | 185 |
internalPanel.contrast.addChangeListener(l); |
189 | 186 |
} |
190 |
|
|
187 |
|
|
191 | 188 |
/** |
192 | 189 |
* A?ade un listener para el slider de brillo |
193 | 190 |
* @param l MouseListener |
... | ... | |
195 | 192 |
public void addBrightnessMouseListener(MouseListener l){ |
196 | 193 |
internalPanel.brightness.addMouseListener(l); |
197 | 194 |
} |
198 |
|
|
195 |
|
|
199 | 196 |
/** |
200 | 197 |
* A?ade un listener para el slider de contraste |
201 | 198 |
* @param l MouseListener |
... | ... | |
203 | 200 |
public void addContrastMouseListener(MouseListener l){ |
204 | 201 |
internalPanel.contrast.addMouseListener(l); |
205 | 202 |
} |
206 |
|
|
203 |
|
|
207 | 204 |
/** |
208 | 205 |
* A?ade un listener para el slider de brillo |
209 | 206 |
* @param l MouseListener |
... | ... | |
211 | 208 |
public void addBrightnessKeyListener(KeyListener l){ |
212 | 209 |
internalPanel.brightness.addKeyListener(l); |
213 | 210 |
} |
214 |
|
|
211 |
|
|
215 | 212 |
/** |
216 | 213 |
* A?ade un listener para el slider de contraste |
217 | 214 |
* @param l MouseListener |
... | ... | |
219 | 216 |
public void addContrastKeyListener(KeyListener l){ |
220 | 217 |
internalPanel.contrast.addKeyListener(l); |
221 | 218 |
} |
222 |
|
|
219 |
|
|
223 | 220 |
/** |
224 | 221 |
* Maneja eventos de activar y desactivar el panel |
225 | 222 |
*/ |
... | ... | |
231 | 228 |
setControlEnabled(false); |
232 | 229 |
} |
233 | 230 |
} |
234 |
|
|
231 |
|
|
235 | 232 |
} |
236 | 233 |
|
Also available in: Unified diff