OSDN Git Service

基準画像ボタンがクリックされた時に、基準時刻フィールドに基準画像の作成日時を設定する。
[importpicture/importpicture.git] / importPicture / src / osm / jp / gpx / matchtime / gui / AdjustTime.java
index 7ec73da..c94ac23 100644 (file)
@@ -2,8 +2,12 @@ package osm.jp.gpx.matchtime.gui;
 import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.io.File;
+import java.util.Date;
+
 import javax.swing.*;
 
+import osm.jp.gpx.ImportPicture;
+
 /**
  * 本プログラムのメインクラス
  */
@@ -107,7 +111,7 @@ public class AdjustTime extends JFrame
         argsPanel.add(arg1Panel_1);
         arg1Panel_2 = new ParameterPanelImageFile("基準時刻画像: ", "", arg1Panel_1);
         argsPanel.add(arg1Panel_2);
-        arg1Panel_3 = new ParameterPanelTime("  基準時刻: ", "yyyy-mm-ddTHH:MM:ss");
+        arg1Panel_3 = new ParameterPanelTime("  基準時刻: ", ImportPicture.TIME_FORMAT_STRING);
         argsPanel.add(arg1Panel_3);
         
         this.getContentPane().add(argsPanel, BorderLayout.NORTH);
@@ -232,10 +236,16 @@ public class AdjustTime extends JFrame
     
     /**
      * 選択された画像ファイルを表示する
+     * 基準画像ボタンがクリックされた時に、基準時刻フィールドに基準画像の作成日時を設定する。
      * @param ev
      */
     public void imageView_Action(ActionEvent ev) {
        String path = (new File(arg1Panel_1.getText(), arg1Panel_2.getText())).getPath();
+       
+       File timeFile = new File(path);
+       long lastModifyTime = timeFile.lastModified();
+       arg1Panel_3.argField.setText(ImportPicture.dfjp.format(new Date(lastModifyTime)));
+       
        int size_x = imageSPane.getWidth() - 8;
        ImageIcon tmpIcon = new ImageIcon(path);
        refImage = tmpIcon;