OSDN Git Service

i18n, reformat, Java8
[importpicture/importpicture.git] / importPicture / src / osm / jp / gpx / matchtime / gui / DoDialog.java
index 8e2e69e..bcaa10f 100644 (file)
@@ -28,12 +28,14 @@ public class DoDialog extends JDialog {
     JTextArea textArea;      // 実行結果を表示するJTextArea   (中央)
     //}}
 
+    @SuppressWarnings("OverridableMethodCallInConstructor")
     public DoDialog(JFrame parentFrame, String[] args) {
         super(parentFrame, true);   // モーダルダイアログを基盤にする
         this.parentFrame = parentFrame;
         this.args = args;
                 
         // INIT_CONTROLS
+        @SuppressWarnings("OverridableMethodCallInConstructor")
         Container container = getContentPane();
         container.setLayout(new BorderLayout());
         parentFrame.setVisible(false);
@@ -109,8 +111,9 @@ public class DoDialog extends JDialog {
 
         super.addNotify();
 
-        if (fComponentsAdjusted)
+        if (fComponentsAdjusted) {
             return;
+        }
 
         // Adjust components according to the insets
         setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
@@ -128,11 +131,11 @@ public class DoDialog extends JDialog {
      * JTextAreaに書き出すOutputStream
      */
     public static class JTextAreaOutputStream extends OutputStream {
-        private ByteArrayOutputStream os;
+        private final ByteArrayOutputStream os;
         
         /** 書き出し対象 */
-        private JTextArea textArea;
-        private String encode;
+        private final JTextArea textArea;
+        private final String encode;
 
         public JTextAreaOutputStream(JTextArea textArea, String encode) {
             this.textArea = textArea;
@@ -143,6 +146,7 @@ public class DoDialog extends JDialog {
         /** 
          * OutputStream#write(byte[])のオーバーライド
          * @param arg
+         * @throws java.io.IOException
          */
         @Override
         public void write(int arg) throws IOException {
@@ -151,18 +155,21 @@ public class DoDialog extends JDialog {
         
         /**
          * flush()でJTextAreaに書き出す
+         * @throws java.io.IOException
          */
         @Override
         public void flush() throws IOException {
             // 文字列のエンコード
             final String str = new String(this.os.toByteArray(), this.encode);
             // 実際の書き出し処理
-            SwingUtilities.invokeLater(new Runnable(){
-                @Override
-                public void run() {
-                    JTextAreaOutputStream.this.textArea.append(str);
+            SwingUtilities.invokeLater(
+                new Runnable(){
+                    @Override
+                    public void run() {
+                        JTextAreaOutputStream.this.textArea.append(str);
+                    }
                 }
-            });
+            );
             // 書き出した内容はクリアする
             this.os.reset();
         }
@@ -170,7 +177,7 @@ public class DoDialog extends JDialog {
     
     // 非同期に行う処理を記述するためのクラス
     class LongTaskWorker extends SwingWorker<Object, Object> {
-        private JButton button;
+        private final JButton button;
 
         public LongTaskWorker(JButton button) {
             this.button = button;
@@ -178,6 +185,7 @@ public class DoDialog extends JDialog {
 
         // 非同期に行われる処理
         @Override
+        @SuppressWarnings("SleepWhileInLoop")
         public Object doInBackground() {
             // ながーい処理
             PrintStream defOut = System.out;