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.InputStreamReader;
12 import java.util.logging.Level;
13 import java.util.logging.Logger;
14 import javax.swing.GroupLayout;
15 import javax.swing.ImageIcon;
16 import javax.swing.JButton;
17 import javax.swing.JDialog;
18 import javax.swing.JLabel;
19 import javax.swing.JPanel;
20 import javax.swing.JScrollPane;
21 import javax.swing.JTextArea;
22 import javax.swing.SwingUtilities;
32 * 説明: ニコニコ動画の動画をコメントつきで保存
36 * 著作権: Copyright (c) 2007 PSI
46 public class MainFrame_AboutBox extends JDialog implements ActionListener {
50 private static final long serialVersionUID = -4256413309312729840L;
51 private static final Logger logger = Logger.getLogger(MainFrame_AboutBox.class.getName());
52 private static final String LINE_FEED = System.getProperty("line.separator");
54 private static final String version = "ver1.22r(2008/04/27)";
56 private static final String product =
57 "本プログラムは「さきゅばす」を改変したものであり, \n" + "オリジナルの著作権は以下の通りです.\n\n" +
60 "Copyright (C) 2008 Saccubus Developers Team\n"+
62 "ニコニコ動画の動画をコメントつきで保存";
64 private final JButton okButton = new JButton();
66 public MainFrame_AboutBox(Frame parent) {
69 setDefaultCloseOperation(DISPOSE_ON_CLOSE);
71 } catch (Exception exception) {
72 logger.log(Level.SEVERE, null, exception);
76 public MainFrame_AboutBox() {
83 * @throws java.lang.Exception
85 private void jbInit() {
86 final JPanel basePanel = new JPanel();
88 final JLabel imageLabel = new JLabel();
89 final ImageIcon icon = new ImageIcon(saccubus.MainFrame_AboutBox.class.getResource("icon.png"));
90 imageLabel.setIcon(icon);
92 final JTextArea productField = new JTextArea(product);
93 productField.setBackground(basePanel.getBackground());
94 productField.setEditable(false);
96 final JScrollPane licensePane = createLicensePane();
98 okButton.setText("OK");
99 okButton.addActionListener(this);
102 basePanel.setPreferredSize(new Dimension(500, 500));
103 GroupLayout gl = new GroupLayout(basePanel);
104 basePanel.setLayout(gl);
106 gl.setHorizontalGroup(gl.createParallelGroup(GroupLayout.Alignment.CENTER)
107 .addGroup(gl.createSequentialGroup()
108 .addGap(15).addComponent(imageLabel).addGap(30).addComponent(productField).addGap(30))
109 .addComponent(licensePane)
110 .addComponent(okButton));
112 gl.setVerticalGroup(gl.createSequentialGroup()
114 .addGroup(gl.createParallelGroup()
115 .addComponent(imageLabel).addComponent(productField))
117 .addComponent(licensePane)
118 .addComponent(okButton));
120 getContentPane().add(basePanel, null);
126 private JScrollPane createLicensePane() {
127 final JTextArea licenseField = new JTextArea();
128 try (BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(
129 "LICENSE.txt"), "UTF-8"))) {
131 while ((line = reader.readLine()) != null) {
132 licenseField.append(line);
133 licenseField.append(LINE_FEED);
135 }catch(IOException ex){
136 logger.log(Level.SEVERE, null, ex);
139 licenseField.setCaretPosition(0);
140 licenseField.setEditable(false);
141 final JScrollPane licensePane = new JScrollPane(licenseField);
152 public void actionPerformed(ActionEvent actionEvent) {
153 if (actionEvent.getSource() == okButton) {
158 public static void main(String[] args){
159 SwingUtilities.invokeLater(new Runnable() {
163 MainFrame_AboutBox frame = new MainFrame_AboutBox();
165 frame.setVisible(true);