OSDN Git Service

i18n, reformat, Java8
[importpicture/importpicture.git] / importPicture / src / osm / jp / gpx / matchtime / gui / QuitDialog.java
index 26eb088..bf5b9e3 100644 (file)
@@ -6,6 +6,7 @@ import java.awt.Toolkit;
 import java.awt.Window;
 import java.awt.event.WindowEvent;
 import java.awt.event.WindowListener;
+import java.util.ResourceBundle;
 
 import javax.swing.JButton;
 import javax.swing.JDialog;
@@ -15,49 +16,55 @@ import javax.swing.JLabel;
 @SuppressWarnings("serial")
 public class QuitDialog extends JDialog implements WindowListener
 {
-       public static final String TITLE = "終了?";
     JButton yesButton;
     JButton noButton;
     JLabel label1;
 
+    @SuppressWarnings("OverridableMethodCallInConstructor")
     public QuitDialog(JFrame parent, boolean modal) {
         super(parent, modal);
+        
+        ResourceBundle i18n = ResourceBundle.getBundle("i18n");
+
         addWindowListener((WindowListener) this);
         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
 
         setLayout(null);
         setSize(getInsets().left + getInsets().right + 337, getInsets().top + getInsets().bottom + 135);
         
-        yesButton = new JButton("  終了  ");
+        yesButton = new JButton(String.format("  %s  ", i18n.getString("dialog.quit")));
         yesButton.addActionListener(new java.awt.event.ActionListener() {
-               public void actionPerformed(java.awt.event.ActionEvent evt) {
+            @Override
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
                 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent((Window)getParent(), 201));
                 System.exit(0);
-               }
+            }
         });
         yesButton.setBounds(getInsets().left + 72, getInsets().top + 80, 79, 22);
         yesButton.setFont(new Font("Dialog", 1, 12));
         add(yesButton);
 
-        noButton = new JButton("キャンセル");
+        noButton = new JButton(i18n.getString("dialog.cancel"));
         noButton.addActionListener(new java.awt.event.ActionListener() {
-               public void actionPerformed(java.awt.event.ActionEvent evt) {
-                       Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(QuitDialog.this, WindowEvent.WINDOW_CLOSING));
-                       setVisible(false);
-               }
+            @Override
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(QuitDialog.this, WindowEvent.WINDOW_CLOSING));
+                setVisible(false);
+            }
         });
         noButton.setBounds(getInsets().left + 185, getInsets().top + 80, 99, 22);
         noButton.setFont(new Font("Dialog", 1, 12));
         add(noButton);
         
-        label1 = new JLabel("プログラムを終了します。", JLabel.CENTER);
+        label1 = new JLabel(i18n.getString("dialog.msg1"), JLabel.CENTER);
         label1.setBounds(78, 33, 180, 23);
         add(label1);
-        setTitle("プログラムの終了");
+        setTitle(i18n.getString("dialog.msg1"));
         setResizable(false);
         setVisible(true);
     }
 
+    @Override
     public void setVisible(boolean b) {
         if(b) {
             Rectangle bounds = getParent().getBounds();
@@ -68,26 +75,33 @@ public class QuitDialog extends JDialog implements WindowListener
     }
 
 
-       public void windowActivated(WindowEvent e) {
-       }
+    @Override
+    public void windowActivated(WindowEvent e) {
+    }
 
-       public void windowClosed(WindowEvent e) {
-               setVisible(false);
-       }
+    @Override
+    public void windowClosed(WindowEvent e) {
+        setVisible(false);
+    }
 
-       public void windowClosing(WindowEvent e) {
-               setVisible(false);
-       }
+    @Override
+    public void windowClosing(WindowEvent e) {
+        setVisible(false);
+    }
 
-       public void windowDeactivated(WindowEvent e) {
-       }
+    @Override
+    public void windowDeactivated(WindowEvent e) {
+    }
 
-       public void windowDeiconified(WindowEvent e) {
-       }
+    @Override
+    public void windowDeiconified(WindowEvent e) {
+    }
 
-       public void windowIconified(WindowEvent e) {
-       }
+    @Override
+    public void windowIconified(WindowEvent e) {
+    }
 
-       public void windowOpened(WindowEvent e) {
-       }
+    @Override
+    public void windowOpened(WindowEvent e) {
+    }
 }