OSDN Git Service

リファクタリング
authorhayashi yuu <hayashi.yuu@gmail.com>
Sun, 26 Jul 2015 10:35:51 +0000 (19:35 +0900)
committerhayashi yuu <hayashi.yuu@gmail.com>
Sun, 26 Jul 2015 10:35:51 +0000 (19:35 +0900)
importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java

index 3783655..8ca1df5 100644 (file)
@@ -3,9 +3,7 @@ import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.io.File;
 import java.util.Date;
-
 import javax.swing.*;
-
 import osm.jp.gpx.ImportPicture;
 
 /**
@@ -14,9 +12,9 @@ import osm.jp.gpx.ImportPicture;
 @SuppressWarnings("serial")
 public class AdjustTime extends JFrame
 {
-       public static final String PROGRAM_NAME = "AdjustTime for JOSM";
-       public static final String PROGRAM_VARSION = "2.0";
-       public static final String PROGRAM_UPDATE = "2015/05/30";
+    public static final String PROGRAM_NAME = "AdjustTime for JOSM";
+    public static final String PROGRAM_VARSION = "3.0";
+    public static final String PROGRAM_UPDATE = "2015/07/26";
        
     // Used for addNotify check.
     boolean fComponentsAdjusted = false;
@@ -54,6 +52,7 @@ public class AdjustTime extends JFrame
          * このFrameが閉じられるときの動作。
          * 終了確認のパネルを表示して、[OK]が押されたら終了する
          */
+        @Override
         public void windowClosing(java.awt.event.WindowEvent event) {
             Object object = event.getSource();
             if (object == AdjustTime.this) {
@@ -63,6 +62,7 @@ public class AdjustTime extends JFrame
     }
 
     class SymAction implements java.awt.event.ActionListener {
+        @Override
         public void actionPerformed(java.awt.event.ActionEvent event) {
             Object object = event.getSource();
             if (object == miAbout) {
@@ -182,6 +182,7 @@ public class AdjustTime extends JFrame
      * @param b        trueのときコンポーネントを表示; その他のとき, componentを隠す.
      * @see java.awt.Component#isVisible
      */
+    @Override
     public void setVisible(boolean b) {
         if(b) {
             setLocation(50, 50);
@@ -190,21 +191,21 @@ public class AdjustTime extends JFrame
         super.setVisible(b);
     }
     
-       /**
-        * このクラスをインスタンスを生成して表示する。
-        * コマンドラインの引数はありません。
-        */    
+    /**
+     * このクラスをインスタンスを生成して表示する。
+     * コマンドラインの引数はありません。
+     * @param args
+     */    
     static public void main(String args[]) {
-       SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                createAndShowGUI();
-            }
+       SwingUtilities.invokeLater(() -> {
+            createAndShowGUI();
         });
     }
     private static void createAndShowGUI() {
        (new AdjustTime()).setVisible(true);
     }
 
+    @Override
     public void addNotify()    {
         // Record the size of the window prior to calling parents addNotify.
         Dimension d = getSize();
@@ -217,10 +218,10 @@ public class AdjustTime extends JFrame
         // Adjust components according to the insets
         setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
         Component components[] = getComponents();
-        for (int i = 0; i < components.length; i++){
-            Point p = components[i].getLocation();
+        for (Component component : components) {
+            Point p = component.getLocation();
             p.translate(getInsets().left, getInsets().top);
-            components[i].setLocation(p);
+            component.setLocation(p);
         }
         fComponentsAdjusted = true;
     }
@@ -326,7 +327,9 @@ public class AdjustTime extends JFrame
         fc.setSelectedFile(null);
     }
     
-    /** Returns an ImageIcon, or null if the path was invalid. */
+    /** Returns an ImageIcon, or null if the path was invalid.
+     * @param path
+     * @return  */
     public static ImageIcon createImageIcon(String path) {
         java.net.URL imgURL = AdjustTime.class.getResource(path);
         if (imgURL != null) {
@@ -345,14 +348,13 @@ public class AdjustTime extends JFrame
        arg1Panel_3.doButton.setEnabled(false);
 
        String[] argv = new String[4];
-               //argv[0] = "list.csv";
-               argv[0] = arg1Panel_1.getText();
-               argv[1] = arg1Panel_2.getText();
-               argv[2] = arg1Panel_3.getText();
-               String value = (String) arg1Panel_4.field.getSelectedItem();
-               argv[3] = (value.equals("更新する") ? "EXIF" : "none");
-               
-               (new DoDialog(this, argv)).setVisible(true);
+        argv[0] = arg1Panel_1.getText();
+        argv[1] = arg1Panel_2.getText();
+        argv[2] = arg1Panel_3.getText();
+        String value = (String) arg1Panel_4.field.getSelectedItem();
+        argv[3] = (value.equals("更新する") ? "EXIF" : "none");
+
+        (new DoDialog(this, argv)).setVisible(true);
                
        arg1Panel_3.doButton.setEnabled(true);
     }