View Javadoc

1   /*
2    * AboutJPanel.java
3    *
4    * Created on 13 January 2007, 06:03
5    */
6   
7   package org.wiztools.jenkryptor;
8   
9   import java.awt.Font;
10  import java.io.IOException;
11  import java.io.InputStream;
12  import javax.swing.SwingUtilities;
13  
14  /***
15   *
16   * @author  subhash
17   */
18  public class AboutJPanel extends javax.swing.JPanel {
19      
20      /*** Creates new form AboutJPanel */
21      public AboutJPanel() {
22          initComponents();
23          
24          jTextArea1.setFont(new Font("Monospaced", Font.PLAIN, 12));
25          
26          InputStream is = this.getClass().getClassLoader().getResourceAsStream("org/wiztools/jenkryptor/ABOUT");
27          try{
28              int i = -1;
29              byte[] buffer = new byte[0xFFFF];
30              final StringBuffer sb = new StringBuffer();
31              while((i=is.read(buffer))!=-1){
32                  sb.append(new String(buffer, 0, i));
33              }
34              is.close();
35              
36              SwingUtilities.invokeLater(new Runnable() {
37                  public void run() {
38                      jTextArea1.setText(sb.toString());
39                  }
40              });
41          } catch(IOException ioe) {
42              assert true: "ABOUT file not found in Jar!";
43          }
44      }
45      
46      /*** This method is called from within the constructor to
47       * initialize the form.
48       * WARNING: Do NOT modify this code. The content of this method is
49       * always regenerated by the Form Editor.
50       */
51      // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
52      private void initComponents() {
53          jLabel1 = new javax.swing.JLabel();
54          jScrollPane1 = new javax.swing.JScrollPane();
55          jTextArea1 = new javax.swing.JTextArea();
56          jbOk = new javax.swing.JButton();
57  
58          jLabel1.setFont(new java.awt.Font("Dialog", 1, 24));
59          jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
60          jLabel1.setText("jEnkryptor");
61  
62          jTextArea1.setColumns(20);
63          jTextArea1.setEditable(false);
64          jTextArea1.setRows(5);
65          jScrollPane1.setViewportView(jTextArea1);
66  
67          jbOk.setMnemonic('o');
68          jbOk.setText("Ok");
69          jbOk.addActionListener(new java.awt.event.ActionListener() {
70              public void actionPerformed(java.awt.event.ActionEvent evt) {
71                  jbOkActionPerformed(evt);
72              }
73          });
74  
75          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
76          this.setLayout(layout);
77          layout.setHorizontalGroup(
78              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
79              .addGroup(layout.createSequentialGroup()
80                  .addContainerGap()
81                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
82                      .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE)
83                      .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE)
84                      .addComponent(jbOk, javax.swing.GroupLayout.Alignment.TRAILING))
85                  .addContainerGap())
86          );
87          layout.setVerticalGroup(
88              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
89              .addGroup(layout.createSequentialGroup()
90                  .addContainerGap()
91                  .addComponent(jLabel1)
92                  .addGap(15, 15, 15)
93                  .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
94                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
95                  .addComponent(jbOk)
96                  .addContainerGap())
97          );
98      }// </editor-fold>//GEN-END:initComponents
99  
100     private void jbOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbOkActionPerformed
101         Globals.MAIN_FRAME.setJDVisible(false);
102     }//GEN-LAST:event_jbOkActionPerformed
103     
104     
105     // Variables declaration - do not modify//GEN-BEGIN:variables
106     private javax.swing.JLabel jLabel1;
107     private javax.swing.JScrollPane jScrollPane1;
108     private javax.swing.JTextArea jTextArea1;
109     private javax.swing.JButton jbOk;
110     // End of variables declaration//GEN-END:variables
111     
112 }