OSDN Git Service

いんきゅばす/さきゅばすホームページジャンプボタンを追加
authoryukihane <yukihane.feather@gmail.com>
Wed, 14 Sep 2011 04:24:22 +0000 (13:24 +0900)
committeryukihane <yukihane.feather@gmail.com>
Wed, 14 Sep 2011 04:24:22 +0000 (13:24 +0900)
frontend/src/saccubus/MainFrame_AboutBox.java

index 7a24b3d..c2f60d5 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,6 +12,7 @@ import java.awt.event.ActionListener;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.net.URI;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.swing.BorderFactory;
@@ -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;
 
 /**
@@ -51,7 +55,7 @@ public class MainFrame_AboutBox extends JDialog implements ActionListener {
     private static final long serialVersionUID = -4256413309312729840L;
     private static final Logger logger = Logger.getLogger(MainFrame_AboutBox.class.getName());
     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);
@@ -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.log(Level.SEVERE, 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.log(Level.SEVERE, 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)
         );
 
 
@@ -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();
         }
     }