diff --git a/importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java b/importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java index 92327fd..db305d8 100644 --- a/importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java +++ b/importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java @@ -55,7 +55,7 @@ JCheckBox gpxOverwriteMagvar; // ソースGPXのを無視する JCheckBox gpxOutputSpeed; // GPXにを書き出す ParameterPanelFolder arg5_outputFolder; // EXIF 書き出しフォルダ - ParameterPanelFolder arg4_gpxFolder; // GPXファイル・フォルダ + ParameterPanelGpx arg4_gpxFolder; // GPXファイル・フォルダ JPanel buttonPanel; // ボタンパネル (下部) JButton openButton; // [Fit]ボタン @@ -262,7 +262,7 @@ JPanel tmpPanel4a = new JPanel(); tmpPanel4a.setLayout(new BoxLayout(tmpPanel4a, BoxLayout.Y_AXIS)); - arg4_gpxFolder = new ParameterPanelFolder("GPXフォルダ: ", params.getProperty(AppParameters.IMG_SOURCE_FOLDER), JFileChooser.FILES_AND_DIRECTORIES); + arg4_gpxFolder = new ParameterPanelGpx("GPXフォルダ: ", params.getProperty(AppParameters.GPX_SOURCE_FOLDER)); tmpPanel4a.add(arg4_gpxFolder); noFirstNode = new JCheckBox("セグメントの最初の1ノードは無視する。", params.getProperty(AppParameters.GPX_NO_FIRST_NODE).equals("ON")); tmpPanel4a.add(noFirstNode); diff --git a/importPicture/src/osm/jp/gpx/matchtime/gui/GpxAndFolderFilter.java b/importPicture/src/osm/jp/gpx/matchtime/gui/GpxAndFolderFilter.java new file mode 100644 index 0000000..26808e0 --- /dev/null +++ b/importPicture/src/osm/jp/gpx/matchtime/gui/GpxAndFolderFilter.java @@ -0,0 +1,28 @@ +package osm.jp.gpx.matchtime.gui; + +import java.io.File; +import javax.swing.filechooser.*; + +public class GpxAndFolderFilter extends FileFilter { + + public boolean accept(File f) { + if (f.isDirectory()) { + return true; + } + + String extension = Utils.getExtension(f); + if (extension != null) { + if (extension.equals("gpx")) { + return true; + } + else { + return false; + } + } + return false; + } + + public String getDescription() { + return "Just GPXs"; + } +} diff --git a/importPicture/src/osm/jp/gpx/matchtime/gui/GpxFilter.java b/importPicture/src/osm/jp/gpx/matchtime/gui/GpxFilter.java deleted file mode 100644 index 6261a10..0000000 --- a/importPicture/src/osm/jp/gpx/matchtime/gui/GpxFilter.java +++ /dev/null @@ -1,28 +0,0 @@ -package osm.jp.gpx.matchtime.gui; - -import java.io.File; -import javax.swing.filechooser.*; - -public class GpxFilter extends FileFilter { - - public boolean accept(File f) { - if (f.isDirectory()) { - return true; - } - - String extension = Utils.getExtension(f); - if (extension != null) { - if (extension.equals("gpx")) { - return true; - } - else { - return false; - } - } - return false; - } - - public String getDescription() { - return "Just GPXs"; - } -} diff --git a/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelGpx.java b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelGpx.java new file mode 100644 index 0000000..a2dde05 --- /dev/null +++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelGpx.java @@ -0,0 +1,50 @@ +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 ParameterPanelGpx extends ParameterPanel implements ActionListener { + JFileChooser fc; + JButton openButton; + + public ParameterPanelGpx(String label, String text) { + super(label, text); + + openButton = new JButton("選択...", AdjustTime.createImageIcon("images/Open16.gif")); + openButton.addActionListener(this); + this.add(openButton); + } + + public void setEnable(boolean f) { + super.setEnabled(f); + openButton.setEnabled(f); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == openButton){ + System.out.println("ParameterPanelGpx.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(JFileChooser.FILES_AND_DIRECTORIES); + this.fc.addChoosableFileFilter(new GpxAndFolderFilter()); + this.fc.setAcceptAllFileFilterUsed(false); + + int returnVal = this.fc.showOpenDialog(ParameterPanelGpx.this); + + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = this.fc.getSelectedFile(); + this.argField.setText(file.getAbsolutePath()); + } + } + } +}