| 1 | /* |
| 2 | * Copyright (c) 2005 The PseudoQ Project. |
| 3 | * |
| 4 | * This file is part of PseudoQ. |
| 5 | * |
| 6 | * PseudoQ is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU Lesser General Public License as published by |
| 8 | * the Free Software Foundation; either version 2.1 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * PseudoQ is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public License |
| 17 | * along with PseudoQ; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | package net.sourceforge.pseudoq.gui; |
| 22 | |
| 23 | /** |
| 24 | * "About" information dialog window. |
| 25 | * @author <a href="http://sourceforge.net/users/stevensa">Andrew Stevens</a> |
| 26 | */ |
| 27 | public class AboutDialog extends javax.swing.JDialog { |
| 28 | /** A return status code - returned if Cancel button has been pressed */ |
| 29 | public static final int RET_CANCEL = 0; |
| 30 | /** A return status code - returned if OK button has been pressed */ |
| 31 | public static final int RET_OK = 1; |
| 32 | |
| 33 | /** Creates new form AboutDialog */ |
| 34 | public AboutDialog(java.awt.Frame parent, boolean modal) { |
| 35 | super(parent, modal); |
| 36 | initComponents(); |
| 37 | } |
| 38 | |
| 39 | /** @return the return status of this dialog - one of RET_OK or RET_CANCEL */ |
| 40 | public int getReturnStatus() { |
| 41 | return returnStatus; |
| 42 | } |
| 43 | |
| 44 | /** This method is called from within the constructor to |
| 45 | * initialize the form. |
| 46 | * WARNING: Do NOT modify this code. The content of this method is |
| 47 | * always regenerated by the Form Editor. |
| 48 | */ |
| 49 | // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents |
| 50 | private void initComponents() { |
| 51 | jTabbedPane1 = new javax.swing.JTabbedPane(); |
| 52 | textPanel = new javax.swing.JPanel(); |
| 53 | jTextArea1 = new javax.swing.JTextArea(); |
| 54 | jScrollPane2 = new javax.swing.JScrollPane(); |
| 55 | textPanel1 = new javax.swing.JPanel(); |
| 56 | jTextArea2 = new javax.swing.JTextArea(); |
| 57 | jScrollPane1 = new javax.swing.JScrollPane(); |
| 58 | textPanel2 = new javax.swing.JPanel(); |
| 59 | jTextArea3 = new javax.swing.JTextArea(); |
| 60 | buttonPanel = new javax.swing.JPanel(); |
| 61 | okButton = new javax.swing.JButton(); |
| 62 | |
| 63 | setTitle("About PseudoQ"); |
| 64 | addWindowListener(new java.awt.event.WindowAdapter() { |
| 65 | public void windowClosing(java.awt.event.WindowEvent evt) { |
| 66 | closeDialog(evt); |
| 67 | } |
| 68 | }); |
| 69 | |
| 70 | jTabbedPane1.setPreferredSize(new java.awt.Dimension(400, 400)); |
| 71 | textPanel.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(15, 15, 15, 15))); |
| 72 | jTextArea1.setText("<html>\n<h1>PsudoQ v0.1</h1>\n<p>© 2005 <a href=\"mailto:stevensa@users.sourceforge.net\">Andy Stevens</a></p>\n</html>"); |
| 73 | jTextArea1.setPreferredSize(new java.awt.Dimension(300, 300)); |
| 74 | textPanel.add(jTextArea1); |
| 75 | |
| 76 | jTabbedPane1.addTab("About", textPanel); |
| 77 | |
| 78 | jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
| 79 | textPanel1.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(15, 15, 15, 15))); |
| 80 | jTextArea2.setEditable(false); |
| 81 | jTextArea2.setLineWrap(true); |
| 82 | jTextArea2.setText("Copyright (c) 2005 The PseudoQ Project.\n\nPseudoQ is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.\n\nPseudoQ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License along with PseudoQ; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n\n\nOther software.\n\nPseudoQ includes software distributed under various licenses. See the appropriate license files in the documentation for details."); |
| 83 | jTextArea2.setWrapStyleWord(true); |
| 84 | jTextArea2.setPreferredSize(new java.awt.Dimension(320, 500)); |
| 85 | textPanel1.add(jTextArea2); |
| 86 | |
| 87 | jScrollPane2.setViewportView(textPanel1); |
| 88 | |
| 89 | jTabbedPane1.addTab("License", jScrollPane2); |
| 90 | |
| 91 | textPanel2.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(15, 15, 15, 15))); |
| 92 | jTextArea3.setEditable(false); |
| 93 | StringBuffer propsBuffer = new StringBuffer(); |
| 94 | java.util.Properties sysProps = System.getProperties(); |
| 95 | for (java.util.Enumeration e = sysProps.propertyNames(); e.hasMoreElements();) { |
| 96 | String prop = (String) e.nextElement(); |
| 97 | propsBuffer.append(prop + "=" + sysProps.getProperty(prop) + "\n"); |
| 98 | } |
| 99 | jTextArea3.setText(propsBuffer.toString()); |
| 100 | jTextArea3.setPreferredSize(new java.awt.Dimension(512, 512)); |
| 101 | textPanel2.add(jTextArea3); |
| 102 | |
| 103 | jScrollPane1.setViewportView(textPanel2); |
| 104 | |
| 105 | jTabbedPane1.addTab("System", jScrollPane1); |
| 106 | |
| 107 | getContentPane().add(jTabbedPane1, java.awt.BorderLayout.NORTH); |
| 108 | |
| 109 | buttonPanel.setLayout(new java.awt.BorderLayout()); |
| 110 | |
| 111 | okButton.setText("OK"); |
| 112 | okButton.addActionListener(new java.awt.event.ActionListener() { |
| 113 | public void actionPerformed(java.awt.event.ActionEvent evt) { |
| 114 | okButtonActionPerformed(evt); |
| 115 | } |
| 116 | }); |
| 117 | |
| 118 | buttonPanel.add(okButton, java.awt.BorderLayout.CENTER); |
| 119 | |
| 120 | getContentPane().add(buttonPanel, java.awt.BorderLayout.SOUTH); |
| 121 | |
| 122 | pack(); |
| 123 | } |
| 124 | // </editor-fold>//GEN-END:initComponents |
| 125 | |
| 126 | private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed |
| 127 | doClose(RET_OK); |
| 128 | }//GEN-LAST:event_okButtonActionPerformed |
| 129 | |
| 130 | /** Closes the dialog */ |
| 131 | private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog |
| 132 | doClose(RET_CANCEL); |
| 133 | }//GEN-LAST:event_closeDialog |
| 134 | |
| 135 | private void doClose(int retStatus) { |
| 136 | returnStatus = retStatus; |
| 137 | setVisible(false); |
| 138 | dispose(); |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * @param args the command line arguments |
| 143 | */ |
| 144 | public static void main(String args[]) { |
| 145 | java.awt.EventQueue.invokeLater(new Runnable() { |
| 146 | public void run() { |
| 147 | new AboutDialog(new javax.swing.JFrame(), true).setVisible(true); |
| 148 | } |
| 149 | }); |
| 150 | } |
| 151 | |
| 152 | // Variables declaration - do not modify//GEN-BEGIN:variables |
| 153 | private javax.swing.JPanel buttonPanel; |
| 154 | private javax.swing.JScrollPane jScrollPane1; |
| 155 | private javax.swing.JScrollPane jScrollPane2; |
| 156 | private javax.swing.JTabbedPane jTabbedPane1; |
| 157 | private javax.swing.JTextArea jTextArea1; |
| 158 | private javax.swing.JTextArea jTextArea2; |
| 159 | private javax.swing.JTextArea jTextArea3; |
| 160 | private javax.swing.JButton okButton; |
| 161 | private javax.swing.JPanel textPanel; |
| 162 | private javax.swing.JPanel textPanel1; |
| 163 | private javax.swing.JPanel textPanel2; |
| 164 | // End of variables declaration//GEN-END:variables |
| 165 | |
| 166 | private int returnStatus = RET_CANCEL; |
| 167 | |
| 168 | } |