From d4f7bbdd9169455509f72fee063654320465182d Mon Sep 17 00:00:00 2001 From: hayashi Date: Sat, 3 Jun 2017 11:21:32 +0900 Subject: [PATCH] =?utf8?q?enhance:=20GPX=E3=82=92=E9=81=B8=E6=8A=9E?= =?utf8?q?=E3=81=99=E3=82=8B=E9=9A=9B=E3=81=AB=E3=80=81GPX=E3=83=95?= =?utf8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=AE=E3=81=BF=E8=A1=A8=E7=A4=BA?= =?utf8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/osm/jp/gpx/matchtime/gui/AdjustTime.java | 4 +- .../{GpxFilter.java => GpxAndFolderFilter.java} | 2 +- .../jp/gpx/matchtime/gui/ParameterPanelGpx.java | 50 ++++++++++++++++++++++ 3 files changed, 53 insertions(+), 3 deletions(-) rename importPicture/src/osm/jp/gpx/matchtime/gui/{GpxFilter.java => GpxAndFolderFilter.java} (91%) create mode 100644 importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelGpx.java 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 @@ public class AdjustTime extends JFrame 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 @@ public class AdjustTime extends JFrame 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/GpxFilter.java b/importPicture/src/osm/jp/gpx/matchtime/gui/GpxAndFolderFilter.java similarity index 91% rename from importPicture/src/osm/jp/gpx/matchtime/gui/GpxFilter.java rename to importPicture/src/osm/jp/gpx/matchtime/gui/GpxAndFolderFilter.java index 6261a10..26808e0 100644 --- a/importPicture/src/osm/jp/gpx/matchtime/gui/GpxFilter.java +++ b/importPicture/src/osm/jp/gpx/matchtime/gui/GpxAndFolderFilter.java @@ -3,7 +3,7 @@ package osm.jp.gpx.matchtime.gui; import java.io.File; import javax.swing.filechooser.*; -public class GpxFilter extends FileFilter { +public class GpxAndFolderFilter extends FileFilter { public boolean accept(File f) { if (f.isDirectory()) { 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()); + } + } + } +} -- 2.11.0