3 import static javax.swing.WindowConstants.*;
5 import java.awt.Dimension;
7 import java.awt.event.ActionEvent;
8 import java.awt.event.ActionListener;
9 import java.io.BufferedReader;
10 import java.io.IOException;
11 import java.io.InputStream;
12 import java.io.InputStreamReader;
13 import java.util.logging.Level;
14 import java.util.logging.Logger;
15 import javax.swing.GroupLayout;
16 import javax.swing.ImageIcon;
17 import javax.swing.JButton;
18 import javax.swing.JDialog;
19 import javax.swing.JLabel;
20 import javax.swing.JPanel;
21 import javax.swing.JScrollPane;
22 import javax.swing.JTextArea;
23 import javax.swing.SwingUtilities;
33 * 説明: ニコニコ動画の動画をコメントつきで保存
37 * 著作権: Copyright (c) 2007 PSI
47 public class MainFrame_AboutBox extends JDialog implements ActionListener {
51 private static final long serialVersionUID = -4256413309312729840L;
52 private static final Logger logger = Logger.getLogger(MainFrame_AboutBox.class.getName());
53 private static final String LINE_FEED = System.getProperty("line.separator");
55 private static final String version = "ver1.22r(2008/04/27)";
57 private static final String product =
58 "本プログラムは「さきゅばす」を改変したものであり, \n" + "オリジナルの著作権は以下の通りです.\n\n" +
61 "Copyright (C) 2008 Saccubus Developers Team\n"+
63 "ニコニコ動画の動画をコメントつきで保存";
65 private final JButton okButton = new JButton();
67 public MainFrame_AboutBox(Frame parent) {
70 setDefaultCloseOperation(DISPOSE_ON_CLOSE);
72 } catch (Exception exception) {
73 logger.log(Level.SEVERE, null, exception);
77 public MainFrame_AboutBox() {
84 * @throws java.lang.Exception
86 private void jbInit() throws Exception {
87 final JPanel basePanel = new JPanel();
89 final JLabel imageLabel = new JLabel();
90 final ImageIcon icon = new ImageIcon(saccubus.MainFrame_AboutBox.class.getResource("icon.png"));
91 imageLabel.setIcon(icon);
93 final JTextArea productField = new JTextArea(product);
94 productField.setBackground(basePanel.getBackground());
95 productField.setEditable(false);
97 final JScrollPane licensePane = createLicensePane();
99 okButton.setText("OK");
100 okButton.addActionListener(this);
103 basePanel.setPreferredSize(new Dimension(500, 500));
104 GroupLayout gl = new GroupLayout(basePanel);
105 basePanel.setLayout(gl);
107 gl.setHorizontalGroup(gl.createParallelGroup(GroupLayout.Alignment.CENTER)
108 .addGroup(gl.createSequentialGroup()
109 .addGap(15).addComponent(imageLabel).addGap(30).addComponent(productField).addGap(30))
110 .addComponent(licensePane)
111 .addComponent(okButton));
113 gl.setVerticalGroup(gl.createSequentialGroup()
115 .addGroup(gl.createParallelGroup()
116 .addComponent(imageLabel).addComponent(productField))
118 .addComponent(licensePane)
119 .addComponent(okButton));
121 getContentPane().add(basePanel, null);
127 private JScrollPane createLicensePane() throws IOException {
128 final JTextArea licenseField = new JTextArea();
129 InputStream res = null;
131 res = saccubus.MainFrame_AboutBox.class.getResourceAsStream("LICENSE.txt");
132 final BufferedReader reader = new BufferedReader(new InputStreamReader(res, "UTF-8"));
135 while ((line = reader.readLine()) != null) {
136 licenseField.append(line);
137 licenseField.append(LINE_FEED);
144 licenseField.setCaretPosition(0);
145 licenseField.setEditable(false);
146 final JScrollPane licensePane = new JScrollPane(licenseField);
157 public void actionPerformed(ActionEvent actionEvent) {
158 if (actionEvent.getSource() == okButton) {
163 public static void main(String[] args){
164 SwingUtilities.invokeLater(new Runnable() {
168 MainFrame_AboutBox frame = new MainFrame_AboutBox();
170 frame.setVisible(true);