svn-gvsig-desktop / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / tasseledcap / gui / TasseledCapPanel.java @ 14721
History | View | Annotate | Download (16.1 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Iba?ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
|
34 |
* Campus Universitario s/n
|
35 |
* 02071 Alabacete
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 967 599 200
|
39 |
*/
|
40 |
|
41 |
package org.gvsig.remotesensing.tasseledcap.gui; |
42 |
import info.clearthought.layout.TableLayout; |
43 |
|
44 |
import java.awt.BorderLayout; |
45 |
import java.awt.Dimension; |
46 |
import java.awt.GridBagConstraints; |
47 |
import java.awt.GridBagLayout; |
48 |
import java.awt.Insets; |
49 |
import java.awt.event.ActionEvent; |
50 |
import java.awt.event.ActionListener; |
51 |
import java.awt.event.FocusEvent; |
52 |
import java.awt.event.FocusListener; |
53 |
import java.awt.geom.AffineTransform; |
54 |
import java.io.File; |
55 |
import java.util.ArrayList; |
56 |
|
57 |
import javax.swing.BorderFactory; |
58 |
import javax.swing.ButtonGroup; |
59 |
import javax.swing.ComboBoxModel; |
60 |
import javax.swing.DefaultComboBoxModel; |
61 |
import javax.swing.JFileChooser; |
62 |
import javax.swing.JLabel; |
63 |
import javax.swing.JPanel; |
64 |
import javax.swing.JRadioButton; |
65 |
import javax.swing.JTextField; |
66 |
import javax.swing.SwingConstants; |
67 |
import javax.swing.border.CompoundBorder; |
68 |
import javax.swing.border.EmptyBorder; |
69 |
import javax.swing.border.TitledBorder; |
70 |
|
71 |
|
72 |
import org.gvsig.fmap.raster.layers.FLyrRasterSE; |
73 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel; |
74 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent; |
75 |
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener; |
76 |
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel; |
77 |
import org.gvsig.gui.beans.incrementabletask.IncrementableTask; |
78 |
import org.gvsig.raster.buffer.BufferFactory; |
79 |
import org.gvsig.raster.buffer.RasterBufferInvalidException; |
80 |
import org.gvsig.raster.dataset.GeoRasterWriter; |
81 |
import org.gvsig.raster.dataset.IRasterDataSource; |
82 |
import org.gvsig.raster.grid.Grid; |
83 |
import org.gvsig.rastertools.RasterModule; |
84 |
import org.gvsig.remotesensing.tasseledcap.TasseledCapProcess; |
85 |
|
86 |
import com.iver.andami.PluginServices; |
87 |
import com.iver.andami.Utilities; |
88 |
import com.iver.andami.ui.mdiManager.IWindow; |
89 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
90 |
import com.iver.cit.gvsig.addlayer.fileopen.FileOpenWizard; |
91 |
import com.iver.cit.gvsig.fmap.MapContext; |
92 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
93 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
94 |
import com.iver.utiles.swing.JComboBox; |
95 |
|
96 |
|
97 |
|
98 |
/**
|
99 |
* Clase que implementa la ventana de seleccion de parametros para el calculo de la Transformaci?n
|
100 |
* Tasseled Cap.
|
101 |
* @author Alejandro Mu?oz Sanchez
|
102 |
*
|
103 |
* */
|
104 |
public class TasseledCapPanel extends DefaultButtonsPanel implements IWindow,ActionListener,FocusListener,ButtonsPanelListener { |
105 |
|
106 |
private static final long serialVersionUID = 1L; |
107 |
private JPanel centerPanel; |
108 |
private JPanel panelTipo; |
109 |
private MapContext m_MapContext;
|
110 |
private int wPanel=422; |
111 |
private int hPanel=265; |
112 |
private JComboBox comboCapas; |
113 |
private JComboBox comboTipos; |
114 |
private FLayers layers;
|
115 |
private JPanel panelImagen; |
116 |
private final int TIPOLANDSAT_ETM= 2; |
117 |
private final int TIPOLANDSAT_TM=1; |
118 |
private final int TIPOLANDSAT_MS=0; |
119 |
private DefaultComboBoxModel jComboBoxLayersModel; |
120 |
private JTextField jTextNombreCapa; |
121 |
private JPanel nombreCapa; |
122 |
private JRadioButton rButtonFile = null; |
123 |
private JRadioButton rButtonMemory = null; |
124 |
private View view=null; |
125 |
|
126 |
public TasseledCapPanel(View vista) { |
127 |
super();
|
128 |
view= vista; |
129 |
m_MapContext = vista.getModel().getMapContext(); |
130 |
layers = m_MapContext.getLayers(); |
131 |
this.addButtonPressedListener(this); |
132 |
Inicializar(); |
133 |
} |
134 |
|
135 |
|
136 |
public WindowInfo getWindowInfo() {
|
137 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.RESIZABLE);
|
138 |
m_viewinfo.setWidth(wPanel); |
139 |
m_viewinfo.setHeight(hPanel); |
140 |
m_viewinfo.setTitle(PluginServices.getText(this,"tasseled_cap")); |
141 |
m_viewinfo.setX(300);
|
142 |
return m_viewinfo;
|
143 |
} |
144 |
|
145 |
private void Inicializar(){ |
146 |
BorderLayout bd=new BorderLayout(); |
147 |
this.setLayout(bd);
|
148 |
TitledBorder topBorder = BorderFactory.createTitledBorder((PluginServices.getText(this,""))); |
149 |
topBorder.setTitlePosition(TitledBorder.TOP);
|
150 |
this.setBorder(new CompoundBorder(topBorder,new EmptyBorder(5,5,5,5))); |
151 |
this.add(getCenterPanel(), BorderLayout.CENTER); |
152 |
actualizarCombo(getComboTipos().getSelectedIndex()); |
153 |
updateUI(); |
154 |
} |
155 |
|
156 |
|
157 |
public void actionPerformed(ActionEvent e) { |
158 |
if (e.getSource()==getComboTipos()){
|
159 |
actualizarCombo(getComboTipos().getSelectedIndex()); |
160 |
} |
161 |
} |
162 |
|
163 |
public JPanel getCenterPanel(){ |
164 |
if (centerPanel==null){ |
165 |
centerPanel=new JPanel(); |
166 |
centerPanel.setLayout(new GridBagLayout()); |
167 |
TitledBorder topBorder = BorderFactory.createTitledBorder(PluginServices.getText(this,"salida_raster"));; |
168 |
topBorder.setTitlePosition(TitledBorder.TOP);
|
169 |
centerPanel.setBorder(topBorder); |
170 |
GridBagConstraints c = new GridBagConstraints(); |
171 |
c.fill = GridBagConstraints.BOTH;
|
172 |
c.insets=new Insets(8,8,0,8); |
173 |
c.weightx = 1;
|
174 |
c.gridx = 0;
|
175 |
c.gridy = 0;
|
176 |
centerPanel.add(getNombreCapa(), c); |
177 |
c.insets=new Insets(8,8,8,8); |
178 |
c.weightx = 1.0;
|
179 |
c.gridx = 0;
|
180 |
c.gridy = 1;
|
181 |
// Agregar panel que contiene los paneles con los combos
|
182 |
TableLayout thisLayout2 = new TableLayout(new double[][] { |
183 |
{50 ,TableLayout.PREFERRED,50}, |
184 |
{TableLayout.PREFERRED, TableLayout.PREFERRED}}); |
185 |
|
186 |
JPanel p2=new JPanel(); |
187 |
p2.setLayout(thisLayout2); |
188 |
TitledBorder topBorder2 = BorderFactory.createTitledBorder(PluginServices.getText(this,"imagen_transformar"));; |
189 |
topBorder2.setTitlePosition(TitledBorder.TOP);
|
190 |
p2.setBorder(new CompoundBorder(topBorder2,new EmptyBorder(5,5,5,5))); |
191 |
p2.add(getPanelTipo(),"1,0");
|
192 |
p2.add(getPanelImagen(),"1,1");
|
193 |
centerPanel.add(p2, c); |
194 |
} |
195 |
return centerPanel;
|
196 |
} |
197 |
|
198 |
|
199 |
public JPanel getPanelImagen() { |
200 |
if (panelImagen==null){ |
201 |
panelImagen=new JPanel(); |
202 |
|
203 |
// Nuevo panel al que se aaden los elementos
|
204 |
JPanel p=new JPanel(); |
205 |
TableLayout thisLayout = new TableLayout(new double[][] { |
206 |
{ 5, 50,150}, |
207 |
{TableLayout.PREFERRED}}); |
208 |
//Establece la separacin entre los elementos
|
209 |
thisLayout.setHGap(5);
|
210 |
thisLayout.setVGap(5);
|
211 |
p.setLayout(thisLayout); |
212 |
p.add(getComboCapas(),"2,0");
|
213 |
p.add(new JLabel((PluginServices.getText(this,"imagen"))),"1,0"); |
214 |
|
215 |
panelImagen.add(p); |
216 |
} |
217 |
return panelImagen;
|
218 |
} |
219 |
|
220 |
|
221 |
public JPanel getPanelTipo() { |
222 |
if (panelTipo==null){ |
223 |
panelTipo=new JPanel(); |
224 |
JPanel p=new JPanel(); |
225 |
TableLayout thisLayout = new TableLayout(new double[][] { |
226 |
{ 5.0, 50,150}, |
227 |
{TableLayout.PREFERRED}}); |
228 |
thisLayout.setHGap(5);
|
229 |
thisLayout.setVGap(5);
|
230 |
p.setLayout(thisLayout); |
231 |
p.add(getComboTipos(),"2,0");
|
232 |
p.add(new JLabel((PluginServices.getText(this,"tipo"))),"1,0"); |
233 |
panelTipo.add(p); |
234 |
} |
235 |
return panelTipo;
|
236 |
} |
237 |
|
238 |
|
239 |
public DefaultComboBoxModel getComboModel(){ |
240 |
if(jComboBoxLayersModel==null){ |
241 |
jComboBoxLayersModel=new DefaultComboBoxModel(getLayerNames(TIPOLANDSAT_MS)); |
242 |
} |
243 |
return jComboBoxLayersModel;
|
244 |
} |
245 |
|
246 |
|
247 |
/**Panel que incluye el nombre de la capa y las opciones de almacenamieto de la capa de salida*/
|
248 |
public JPanel getNombreCapa() { |
249 |
if (nombreCapa==null){ |
250 |
|
251 |
nombreCapa=new JPanel(); |
252 |
nombreCapa.setPreferredSize(new Dimension(300,200)); |
253 |
GridBagConstraints gridBagConstraints;
|
254 |
JPanel radioPanel = new JPanel(); |
255 |
radioPanel.setLayout(new GridBagLayout()); |
256 |
radioPanel.setBorder(BorderFactory.createTitledBorder("")); |
257 |
ButtonGroup buttonGroup = new ButtonGroup(); |
258 |
buttonGroup.add(getRadioMemory()); |
259 |
|
260 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
261 |
gridBagConstraints.gridx = 0;
|
262 |
gridBagConstraints.gridy = 1;
|
263 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
264 |
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); |
265 |
radioPanel.add(getRadioMemory(),gridBagConstraints); |
266 |
buttonGroup.add(getRadioFile()); |
267 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
268 |
gridBagConstraints.gridx = 0;
|
269 |
gridBagConstraints.gridy = 2;
|
270 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
271 |
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); |
272 |
radioPanel.add(getRadioFile(),gridBagConstraints); |
273 |
//Establece la separacion entre los elementos
|
274 |
nombreCapa.setLayout(new GridBagLayout()); |
275 |
|
276 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
277 |
gridBagConstraints.gridx = 0;
|
278 |
gridBagConstraints.gridy = 0;
|
279 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
280 |
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); |
281 |
nombreCapa.add(new JLabel( (PluginServices.getText(this,"nombre_capa")),SwingConstants.RIGHT ),gridBagConstraints); |
282 |
|
283 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
284 |
gridBagConstraints.gridx = 1;
|
285 |
gridBagConstraints.gridy = 0;
|
286 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
287 |
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); |
288 |
nombreCapa.add(getJTextNombreCapa(),gridBagConstraints); |
289 |
|
290 |
gridBagConstraints = new java.awt.GridBagConstraints();
|
291 |
gridBagConstraints.gridx = 2;
|
292 |
gridBagConstraints.gridy = 0;
|
293 |
gridBagConstraints.anchor = GridBagConstraints.WEST;
|
294 |
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3); |
295 |
nombreCapa.add(radioPanel,gridBagConstraints); |
296 |
} |
297 |
return nombreCapa;
|
298 |
} |
299 |
|
300 |
|
301 |
|
302 |
public JTextField getJTextNombreCapa() { |
303 |
if (jTextNombreCapa==null){ |
304 |
jTextNombreCapa=new JTextField(10); |
305 |
jTextNombreCapa.setText("NewLayer_" + RasterModule.layerCount);
|
306 |
RasterModule.layerCount++; |
307 |
jTextNombreCapa.addFocusListener(this);
|
308 |
} |
309 |
|
310 |
return jTextNombreCapa;
|
311 |
} |
312 |
|
313 |
|
314 |
/**
|
315 |
* Especificar el nombre de la nueva capa para el recuadro de texto asign?ndo
|
316 |
* en cada llamada un nombre consecutivo.
|
317 |
*/
|
318 |
public void setNewLayerText() { |
319 |
getJTextNombreCapa().setText("NewLayer_" + RasterModule.layerCount);
|
320 |
RasterModule.layerCount++; |
321 |
} |
322 |
|
323 |
|
324 |
public JComboBox getComboCapas() { |
325 |
if (comboCapas==null){ |
326 |
comboCapas = new JComboBox(); |
327 |
comboCapas.setModel(getComboModel()); |
328 |
comboCapas.setEnabled(true);
|
329 |
comboCapas.addActionListener(this);
|
330 |
} |
331 |
return comboCapas;
|
332 |
} |
333 |
|
334 |
|
335 |
private void actualizarCombo(int tipo){ |
336 |
getComboModel().removeAllElements(); |
337 |
String []a = getLayerNames(tipo); |
338 |
for (int i=0;i<a.length;i++) |
339 |
getComboModel().addElement(new String(a[i])); |
340 |
|
341 |
if(getComboCapas().getSelectedIndex()==-1){ |
342 |
getButtonsPanel().getButton(1).setEnabled(false); |
343 |
getButtonsPanel().getButton(3).setEnabled(false); |
344 |
} |
345 |
else{
|
346 |
getButtonsPanel().getButton(1).setEnabled(true); |
347 |
getButtonsPanel().getButton(3).setEnabled(true); |
348 |
} |
349 |
updateUI(); |
350 |
} |
351 |
|
352 |
/** Obtine las capas que se adecuan al tipo de imagen dado*/
|
353 |
private String[] getLayerNames(int tipo) { |
354 |
|
355 |
getComboCapas().removeAllItems(); |
356 |
int i,j=0; |
357 |
ArrayList sNames= new ArrayList(); |
358 |
|
359 |
for (i = 0; i < layers.getLayersCount(); i++) { |
360 |
if (layers.getLayer(i)instanceof FLyrRasterSE){ |
361 |
FLyrRasterSE rasterLayer = (FLyrRasterSE)layers.getLayer(i); |
362 |
int bandCount = rasterLayer.getBandCount();
|
363 |
|
364 |
if(tipo==TIPOLANDSAT_MS){
|
365 |
if(bandCount==4){ |
366 |
sNames.add(new String((layers.getLayer(i)).getName())); |
367 |
j++; |
368 |
} |
369 |
} |
370 |
|
371 |
if (tipo==TIPOLANDSAT_ETM){
|
372 |
if(bandCount==6 || bandCount==7){ |
373 |
sNames.add(new String((layers.getLayer(i)).getName())); |
374 |
j++; |
375 |
} |
376 |
} |
377 |
|
378 |
if(tipo==TIPOLANDSAT_TM){
|
379 |
if(bandCount==6 || bandCount==7 ){ |
380 |
sNames.add(new String((layers.getLayer(i)).getName())); |
381 |
j++; |
382 |
} |
383 |
} |
384 |
} |
385 |
} |
386 |
|
387 |
String[] sCapas = new String[sNames.size()]; |
388 |
for(int k=0; k<sNames.size();k++) |
389 |
sCapas[k]=(String)sNames.get(k);
|
390 |
|
391 |
return sCapas;
|
392 |
} |
393 |
|
394 |
|
395 |
public JComboBox getComboTipos() { |
396 |
|
397 |
if(comboTipos==null){ |
398 |
String a[]= {"LandSat MS","LandSat TM","LandaSat ETM+"}; |
399 |
ComboBoxModel jComboBoxLayersModel = new DefaultComboBoxModel(a); |
400 |
comboTipos = new JComboBox(); |
401 |
comboTipos.setModel(jComboBoxLayersModel); |
402 |
comboTipos.setEnabled(true);
|
403 |
comboTipos.addActionListener(this);
|
404 |
} |
405 |
return comboTipos;
|
406 |
} |
407 |
|
408 |
|
409 |
public JRadioButton getRadioFile(){ |
410 |
if (rButtonFile == null){ |
411 |
rButtonFile = new JRadioButton(PluginServices.getText(this,"a_fichero")); |
412 |
rButtonFile.addActionListener(this);
|
413 |
} |
414 |
return rButtonFile;
|
415 |
} |
416 |
|
417 |
public JRadioButton getRadioMemory(){ |
418 |
if (rButtonMemory == null){ |
419 |
rButtonMemory = new JRadioButton(PluginServices.getText(this,"a_memoria"),true); |
420 |
rButtonMemory.addActionListener(this);
|
421 |
} |
422 |
return rButtonMemory;
|
423 |
} |
424 |
|
425 |
public void actionButtonPressed(ButtonsPanelEvent e) { |
426 |
// Bot?n de Aceptar
|
427 |
if (e.getButton() == ButtonsPanel.BUTTON_ACCEPT) {
|
428 |
aplicar(); |
429 |
close(); |
430 |
} |
431 |
|
432 |
// Bot?n de Aplicar
|
433 |
if (e.getButton() == ButtonsPanel.BUTTON_APPLY) {
|
434 |
aplicar(); |
435 |
} |
436 |
|
437 |
// Bot?n de Cerrar
|
438 |
if (e.getButton() == ButtonsPanel.BUTTON_CANCEL) {
|
439 |
close(); |
440 |
} |
441 |
} |
442 |
|
443 |
|
444 |
/**Aplicar procedimiento TasseledCap*/
|
445 |
public void aplicar(){ |
446 |
FLyrRasterSE rasterLayer= (FLyrRasterSE)layers.getLayer((String)getComboCapas().getSelectedItem());
|
447 |
TasseledCapProcess process = new TasseledCapProcess(rasterLayer.getDataSource(),view,getComboTipos().getSelectedIndex(),getFileSelected());
|
448 |
IncrementableTask incrementableTask = new IncrementableTask(process);
|
449 |
process.setIncrementableTask(incrementableTask); |
450 |
incrementableTask.showWindow(); |
451 |
process.start(); |
452 |
incrementableTask.start(); |
453 |
|
454 |
} |
455 |
|
456 |
/**Cierra ventana actual*/
|
457 |
public void close(){ |
458 |
try {
|
459 |
PluginServices.getMDIManager().closeWindow(this);
|
460 |
} catch (ArrayIndexOutOfBoundsException ex) { |
461 |
// Si la ventana no se puede eliminar no hacemos nada
|
462 |
} |
463 |
} |
464 |
|
465 |
public void focusGained(FocusEvent arg0) { |
466 |
} |
467 |
|
468 |
|
469 |
public void focusLost(FocusEvent arg0) { |
470 |
} |
471 |
|
472 |
public String getFileSelected() { |
473 |
String path = ""; |
474 |
if (getRadioFile().isSelected()) {
|
475 |
JFileChooser chooser = new JFileChooser(FileOpenWizard.getLastPath()); |
476 |
chooser.setDialogTitle(PluginServices.getText(this, "seleccionar_fichero")); |
477 |
//A?adimos las extensiones que hayan sido registradas en el driver
|
478 |
String[] extList = GeoRasterWriter.getDriversExtensions(); |
479 |
for(int i=0;i<extList.length;i++) |
480 |
chooser.addChoosableFileFilter(new WriterFilter(extList[i]));
|
481 |
|
482 |
if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION) |
483 |
return null; |
484 |
|
485 |
String fName = chooser.getSelectedFile().toString();
|
486 |
String ext = ((WriterFilter)chooser.getFileFilter()).getDescription();
|
487 |
|
488 |
ext = ext.toLowerCase().substring(ext.lastIndexOf(".") + 1, ext.length()); |
489 |
|
490 |
if ((fName != null) && !fName.equals("")) |
491 |
if (!fName.endsWith("." + ext)) |
492 |
fName = fName + "." + ext;
|
493 |
|
494 |
FileOpenWizard.setLastPath(chooser.getSelectedFile().getPath().substring(0, chooser.getSelectedFile().getPath().lastIndexOf(File.separator))); |
495 |
path = fName; |
496 |
} else {
|
497 |
path = Utilities.createTempDirectory() + File.separator +getJTextNombreCapa().getText() + ".tif"; |
498 |
setNewLayerText(); |
499 |
} |
500 |
return path;
|
501 |
} |
502 |
} |
503 |
/**
|
504 |
* @author Nacho Brodin <brodin_ign@gva.es>
|
505 |
* Filtro para el selector de formatos de escritura
|
506 |
*/
|
507 |
class WriterFilter extends javax.swing.filechooser.FileFilter { |
508 |
private String filter; |
509 |
|
510 |
public WriterFilter(String fil) { |
511 |
this.filter = fil;
|
512 |
} |
513 |
|
514 |
public boolean accept(File f) { |
515 |
return f.isDirectory() || f.getName().toLowerCase().endsWith("." + filter); |
516 |
} |
517 |
|
518 |
public String getDescription() { |
519 |
return "." + filter; |
520 |
} |
521 |
} |
522 |
|
523 |
|
524 |
|