--- /dev/null
+package osm.jp.gpx.matchtime.gui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+
+@SuppressWarnings("serial")
+public class ParameterPanelFolder extends ParameterPanel implements ActionListener
+{
+ JFileChooser fc;
+ JButton openButton;
+ int chooser;
+
+ @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
+ public ParameterPanelFolder(String label, String text, int chooser) {
+ super(label, text);
+
+ // Create a file chooser
+ this.chooser = chooser;
+
+ // "選択..."
+ openButton = new JButton(
+ i18n.getString("button.select"),
+ AdjustTime.createImageIcon("images/Open16.gif")
+ );
+ openButton.addActionListener(this);
+ this.add(openButton);
+ }
+
+ public ParameterPanelFolder(String label, String text) {
+ this(label, text, JFileChooser.DIRECTORIES_ONLY);
+ }
+
+ public void setEnable(boolean f) {
+ super.setEnabled(f);
+ openButton.setEnabled(f);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource() == openButton){
+ System.out.println("ParameterPanelFolder.actionPerformed(openButton)");
+ File sdir = new File(this.argField.getText());
+ if (sdir.exists()) {
+ this.fc = new JFileChooser(sdir);
+ }
+ else {
+ this.fc = new JFileChooser();
+ }
+ this.fc.setFileSelectionMode(this.chooser);
+
+ int returnVal = this.fc.showOpenDialog(ParameterPanelFolder.this);
+
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = this.fc.getSelectedFile();
+ this.argField.setText(file.getAbsolutePath());
+ }
+ }
+ }
+}
\ No newline at end of file