import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
-
-
/**
* <p>
* タイトル: さきゅばす
* @version 1.0
*/
public class MainFrame_AboutBox extends JDialog implements ActionListener {
- /**
- *
- */
- private static final long serialVersionUID = -4256413309312729840L;
+
+ private static final String VERSION = "いんきゅばす 2.0.0";
+ 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();
+
+ public MainFrame_AboutBox(Frame parent) {
+ super(parent);
+ try {
+ setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+ jbInit();
+ } catch (Exception exception) {
+ logger.log(Level.SEVERE, null, exception);
+ }
+ }
- private static final String version = "ver1.22r(2008/04/27)";
-
- private static final String product =
- "本プログラムは「さきゅばす」を改変したものであり, \n" + "オリジナルの著作権は以下の通りです.\n\n" +
- "さきゅばす\n"+
- version + "\n\n"+
- "Copyright (C) 2008 Saccubus Developers Team\n"+
- " 2007-2008 PSI\n\n"+
- "ニコニコ動画の動画をコメントつきで保存";
-
- private final JButton okButton = new JButton();
+ public MainFrame_AboutBox() {
+ this(null);
+ }
- public MainFrame_AboutBox(Frame parent) {
- super(parent);
- try {
- setDefaultCloseOperation(DISPOSE_ON_CLOSE);
- jbInit();
- } catch (Exception exception) {
- logger.log(Level.SEVERE, null, exception);
- }
- }
-
- public MainFrame_AboutBox() {
- this(null);
- }
-
- /**
- * コンポーネントの初期化。
- *
- * @throws java.lang.Exception
- */
- private void jbInit() {
+ /**
+ * コンポーネントの初期化。
+ *
+ * @throws java.lang.Exception
+ */
+ private void jbInit() {
final JPanel basePanel = new JPanel();
final JLabel imageLabel = new JLabel();
final ImageIcon icon = new ImageIcon(saccubus.MainFrame_AboutBox.class.getResource("icon.png"));
- imageLabel.setIcon(icon);
+ imageLabel.setIcon(icon);
- final JTextArea productField = new JTextArea(product);
- productField.setBackground(basePanel.getBackground());
- productField.setEditable(false);
+ final JTextArea productField = createProductField();
+ productField.setBackground(basePanel.getBackground());
final JScrollPane licensePane = createLicensePane();
okButton.addActionListener(this);
- basePanel.setPreferredSize(new Dimension(500, 500));
+ basePanel.setPreferredSize(new Dimension(500, 600));
GroupLayout gl = new GroupLayout(basePanel);
basePanel.setLayout(gl);
.addComponent(licensePane)
.addComponent(okButton));
- getContentPane().add(basePanel, null);
+ getContentPane().add(basePanel, null);
- setTitle("バージョン情報");
+ setTitle("バージョン情報");
setResizable(true);
- }
+ }
+
+ private JTextArea createProductField() {
+ final JTextArea area = new JTextArea();
+ area.append(VERSION);
+ area.append(LINE_FEED);
+ area.append(LINE_FEED);
+
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(
+ "saccubus_description.txt"), "UTF-8"))) {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ area.append(line);
+ area.append(LINE_FEED);
+ }
+ } catch (IOException ex) {
+ logger.log(Level.SEVERE, null, ex);
+ }
+
+ area.setEditable(false);
+ return area;
+ }
private JScrollPane createLicensePane() {
final JTextArea licenseField = new JTextArea();
licenseField.append(line);
licenseField.append(LINE_FEED);
}
- }catch(IOException ex){
+ } catch (IOException ex) {
logger.log(Level.SEVERE, null, ex);
}
return licensePane;
}
- /**
- * ボタンイベントでダイアログを閉じる
- *
- * @param actionEvent
- * ActionEvent
- */
+ /**
+ * ボタンイベントでダイアログを閉じる
+ *
+ * @param actionEvent
+ * ActionEvent
+ */
@Override
- public void actionPerformed(ActionEvent actionEvent) {
- if (actionEvent.getSource() == okButton) {
- dispose();
- }
- }
+ public void actionPerformed(ActionEvent actionEvent) {
+ if (actionEvent.getSource() == okButton) {
+ dispose();
+ }
+ }
- public static void main(String[] args){
+ public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override