1 package osm.jp.gpx.matchtime.gui;
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
6 import javax.swing.JButton;
7 import javax.swing.JFileChooser;
9 @SuppressWarnings("serial")
10 public class ParameterPanelFolder extends ParameterPanel implements ActionListener
16 @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
17 public ParameterPanelFolder(String label, String text, int chooser) {
20 // Create a file chooser
21 this.chooser = chooser;
24 openButton = new JButton(
25 i18n.getString("button.select"),
26 AdjustTime.createImageIcon("images/Open16.gif")
28 openButton.addActionListener(this);
32 public ParameterPanelFolder(String label, String text) {
33 this(label, text, JFileChooser.DIRECTORIES_ONLY);
36 public void setEnable(boolean f) {
38 openButton.setEnabled(f);
42 public void actionPerformed(ActionEvent e) {
43 if (e.getSource() == openButton){
44 System.out.println("ParameterPanelFolder.actionPerformed(openButton)");
45 File sdir = new File(this.argField.getText());
47 this.fc = new JFileChooser(sdir);
50 this.fc = new JFileChooser();
52 this.fc.setFileSelectionMode(this.chooser);
54 int returnVal = this.fc.showOpenDialog(ParameterPanelFolder.this);
56 if (returnVal == JFileChooser.APPROVE_OPTION) {
57 File file = this.fc.getSelectedFile();
58 this.argField.setText(file.getAbsolutePath());