svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / test / java / org / gvsig / gui / beans / swing / jfilechooser / TestJFileChooser.java @ 40561
History | View | Annotate | Download (2.38 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.gui.beans.swing.jfilechooser; |
25 |
|
26 |
import java.awt.BorderLayout; |
27 |
import java.awt.event.ActionEvent; |
28 |
import java.awt.event.ActionListener; |
29 |
import java.io.File; |
30 |
|
31 |
import javax.swing.JButton; |
32 |
import javax.swing.JComboBox; |
33 |
|
34 |
import org.gvsig.gui.beans.TestUI; |
35 |
import org.gvsig.gui.beans.swing.JFileChooser; |
36 |
/**
|
37 |
* Test para el componente JFileChooser. Como se puede apreciar, recuerda el
|
38 |
* ?ltimo directorio elegido para cada caso.
|
39 |
*
|
40 |
* @version 05/12/2007
|
41 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
|
42 |
*/
|
43 |
public class TestJFileChooser implements ActionListener { |
44 |
|
45 |
private TestUI frame = new TestUI("TestJFileChooser"); |
46 |
JComboBox comboBox = null; |
47 |
|
48 |
public TestJFileChooser() {
|
49 |
|
50 |
frame.setLayout(new BorderLayout()); |
51 |
frame.setResizable(false);
|
52 |
comboBox = new JComboBox(); |
53 |
comboBox.addItem("Tablas de color");
|
54 |
comboBox.addItem("Vectorial");
|
55 |
comboBox.addItem("Raster");
|
56 |
comboBox.addItem("Otros");
|
57 |
frame.add(comboBox, BorderLayout.CENTER);
|
58 |
JButton button = new JButton("Abrir fichero"); |
59 |
button.addActionListener(this);
|
60 |
frame.add(button, BorderLayout.SOUTH);
|
61 |
|
62 |
frame.pack(); |
63 |
frame.setVisible(true);
|
64 |
} |
65 |
|
66 |
public static void main(String[] args) { |
67 |
new TestJFileChooser();
|
68 |
} |
69 |
|
70 |
public void actionPerformed(ActionEvent e) { |
71 |
JFileChooser chooser = new JFileChooser(comboBox.getSelectedItem().toString(), (File) null); |
72 |
chooser.showOpenDialog(frame); |
73 |
} |
74 |
} |