From 57838af94a620aa59cb7616e558e0819918eb55d Mon Sep 17 00:00:00 2001 From: yukihane Date: Wed, 14 Sep 2011 13:24:22 +0900 Subject: [PATCH] =?utf8?q?=E3=81=84=E3=82=93=E3=81=8D=E3=82=85=E3=81=B0?= =?utf8?q?=E3=81=99/=E3=81=95=E3=81=8D=E3=82=85=E3=81=B0=E3=81=99=E3=83=9B?= =?utf8?q?=E3=83=BC=E3=83=A0=E3=83=9A=E3=83=BC=E3=82=B8=E3=82=B8=E3=83=A3?= =?utf8?q?=E3=83=B3=E3=83=97=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92=E8=BF=BD?= =?utf8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- frontend/src/saccubus/MainFrame_AboutBox.java | 68 ++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/frontend/src/saccubus/MainFrame_AboutBox.java b/frontend/src/saccubus/MainFrame_AboutBox.java index 7a24b3d..c2f60d5 100644 --- a/frontend/src/saccubus/MainFrame_AboutBox.java +++ b/frontend/src/saccubus/MainFrame_AboutBox.java @@ -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(); } } -- 2.11.0