OSDN Git Service

バージョン表記更新
[coroid/inqubus.git] / frontend / src / saccubus / MainFrame_AboutBox.java
index 7a24b3d..57c8941 100644 (file)
@@ -1,8 +1,10 @@
 package saccubus;
 
+import java.net.URISyntaxException;
 import static javax.swing.WindowConstants.*;
 
 import java.awt.Color;
+import java.awt.Desktop;
 import java.awt.Dimension;
 import java.awt.Frame;
 import java.awt.event.ActionEvent;
@@ -10,8 +12,9 @@ import java.awt.event.ActionListener;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.net.URI;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import javax.swing.BorderFactory;
 import javax.swing.GroupLayout;
 import javax.swing.GroupLayout.Alignment;
@@ -23,6 +26,7 @@ import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 import javax.swing.JTabbedPane;
 import javax.swing.JTextArea;
+import javax.swing.LayoutStyle.ComponentPlacement;
 import javax.swing.SwingUtilities;
 
 /**
@@ -47,11 +51,11 @@ import javax.swing.SwingUtilities;
  */
 public class MainFrame_AboutBox extends JDialog implements ActionListener {
 
-    private static final String VERSION = "いんきゅばす 2.0.0";
+    public static final String VERSION = "いんきゅばす 2.1.0";
     private static final long serialVersionUID = -4256413309312729840L;
-    private static final Logger logger = Logger.getLogger(MainFrame_AboutBox.class.getName());
+    private static final Logger logger = LoggerFactory.getLogger(MainFrame_AboutBox.class);
     private static final String LINE_FEED = System.getProperty("line.separator");
-    private final JButton okButton = new JButton();
+    private final JButton btnOk = new JButton();
 
     public MainFrame_AboutBox(Frame parent) {
         super(parent);
@@ -59,7 +63,7 @@ public class MainFrame_AboutBox extends JDialog implements ActionListener {
             setDefaultCloseOperation(DISPOSE_ON_CLOSE);
             jbInit();
         } catch (Exception exception) {
-            logger.log(Level.SEVERE, null, exception);
+            logger.error(null, exception);
         }
     }
 
@@ -86,31 +90,73 @@ public class MainFrame_AboutBox extends JDialog implements ActionListener {
         fldProduct.setBorder(BorderFactory.createEmptyBorder());
         fldProduct.setBackground(new Color(0, 0, 0, 0));
 
-        final JScrollPane pnlLicense = createLicensePane();
+        final JButton btnInqubus = new JButton("いんきゅばすホームページへ...");
+        btnInqubus.addActionListener(new ActionListener() {
 
-        okButton.setText("OK");
-        okButton.addActionListener(this);
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                if (Desktop.isDesktopSupported()) {
+                    try {
+                        Desktop.getDesktop().browse(new URI("http://sourceforge.jp/projects/coroid/wiki/InqubusV2"));
+                    } catch (IOException | URISyntaxException ex) {
+                        logger.error(null, ex);
+                    }
+                }
+            }
+        });
 
+        final JButton btnSaccubus = new JButton("さきゅばすホームページへ...");
+        btnSaccubus.addActionListener(new ActionListener() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                if (Desktop.isDesktopSupported()) {
+                    try {
+                        Desktop.getDesktop().browse(new URI("http://saccubus.sourceforge.jp/"));
+                    } catch (IOException | URISyntaxException ex) {
+                        logger.error(null, ex);
+                    }
+                }
+            }
+        });
 
         final JPanel pnlAbout = new JPanel();
         GroupLayout glAbout = new GroupLayout(pnlAbout);
         pnlAbout.setLayout(glAbout);
+        glAbout.setAutoCreateContainerGaps(true);
+        glAbout.setAutoCreateGaps(true);
 
         glAbout.setHorizontalGroup(glAbout.createParallelGroup(GroupLayout.Alignment.CENTER)
             .addGroup(glAbout.createSequentialGroup()
-                .addGap(15).addComponent(lblImage).addGap(30).addComponent(fldProduct).addGap(30))
+                .addComponent(lblImage)
+                .addPreferredGap(ComponentPlacement.UNRELATED)
+                .addComponent(fldProduct)
+            )
+            .addGroup(glAbout.createSequentialGroup()
+                .addComponent(btnInqubus)
+                .addComponent(btnSaccubus)
+            )
         );
 
         glAbout.setVerticalGroup(glAbout.createSequentialGroup()
-            .addGap(15)
             .addGroup(glAbout.createParallelGroup()
-                .addComponent(lblImage).addComponent(fldProduct))
-            .addGap(15)
+                .addComponent(lblImage)
+                .addComponent(fldProduct, 0, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
+            )
+            .addGroup(glAbout.createParallelGroup()
+                .addComponent(btnInqubus)
+                .addComponent(btnSaccubus)
+            )
         );
 
         tab.add("About", pnlAbout);
+
+        final JScrollPane pnlLicense = createLicensePane();
         tab.add("License", pnlLicense);
 
+        btnOk.setText("OK");
+        btnOk.addActionListener(this);
+
         final JPanel pnlBase = new JPanel();
         final GroupLayout glBase = new GroupLayout(pnlBase);
         pnlBase.setLayout(glBase);
@@ -119,12 +165,12 @@ public class MainFrame_AboutBox extends JDialog implements ActionListener {
 
         glBase.setHorizontalGroup(glBase.createParallelGroup(Alignment.CENTER)
             .addComponent(tab)
-            .addComponent(okButton)
+            .addComponent(btnOk)
         );
 
         glBase.setVerticalGroup(glBase.createSequentialGroup()
             .addComponent(tab)
-            .addComponent(okButton)
+            .addComponent(btnOk)
         );
 
 
@@ -149,7 +195,7 @@ public class MainFrame_AboutBox extends JDialog implements ActionListener {
                 area.append(LINE_FEED);
             }
         } catch (IOException ex) {
-            logger.log(Level.SEVERE, null, ex);
+            logger.error(null, ex);
         }
 
         area.setEditable(false);
@@ -166,7 +212,7 @@ public class MainFrame_AboutBox extends JDialog implements ActionListener {
                 licenseField.append(LINE_FEED);
             }
         } catch (IOException ex) {
-            logger.log(Level.SEVERE, null, ex);
+            logger.error(null, ex);
         }
 
         licenseField.setCaretPosition(0);
@@ -184,7 +230,7 @@ public class MainFrame_AboutBox extends JDialog implements ActionListener {
      */
     @Override
     public void actionPerformed(ActionEvent actionEvent) {
-        if (actionEvent.getSource() == okButton) {
+        if (actionEvent.getSource() == btnOk) {
             dispose();
         }
     }