Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/robrohan/tools/r2Readme.java


1   /*
2    * Treebeard: an xml xslt transfomer
3    * Copyright (C) 2002 Rob Rohan
4    * This program is free software; you can redistribute it and/or modify it
5    * under the terms of the GNU General Public License as published by the
6    * Free Software Foundation; either version 2 of the License, or (at your
7    * option) any later version.
8    * 
9    * This program is distributed in the hope that it will be useful, but 
10   * WITHOUT ANY WARRANTY; without even the implied warranty of 
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
12   * General Public License for more details.
13   * 
14   * You should have received a copy of the GNU General Public License along 
15   * with this program; if not, write to the Free Software Foundation, Inc.,
16   * 675 Mass Ave, Cambridge, MA 02139, USA.
17   *
18   * Email: me@robrohan.com
19   * 
20   * r2Readme.java
21   *
22   * Created on December 2, 2001, 5:21 PM
23   */
24  
25  /**
26   *
27   * @author  rob
28   */
29  package com.robrohan.tools;
30  
31  /** Old ReadMe
32   * @deprecated This class is no longer used. Please use ReadMe instead.
33   */
34  public class r2Readme extends javax.swing.JDialog {
35  
36      String filename = "/Readme.txt";
37          
38      /** Creates new form r2Readme */
39      public r2Readme(java.awt.Frame parent, boolean modal) {
40          super(parent, modal);
41          initComponents();
42      }
43  
44      public void setFileName(String filename){
45          this.filename = filename;
46      }
47      
48      public String getFileName(){
49          return this.filename;
50      }
51      
52      public void loadFile(){
53          StringBuffer fileContents = new StringBuffer();
54          int b;
55          
56          try{
57              java.io.DataInputStream fin = new java.io.DataInputStream(getClass().getResourceAsStream(this.filename));
58              
59              while((b = fin.read()) != -1){
60                  fileContents.append((char)b);
61              }
62              
63          }catch (Exception e){ System.err.println("r2Readme->r2Readme: " + e.toString());}
64           
65          this.txtDisplay.setText(fileContents.toString());
66          
67          this.txtDisplay.setEditable(false);
68          //seek to the top of the file
69          this.txtDisplay.setCaretPosition(0);
70      }
71      
72      /** This method is called from within the constructor to
73       * initialize the form.
74       * WARNING: Do NOT modify this code. The content of this method is
75       * always regenerated by the Form Editor.
76       */
77      private void initComponents() {//GEN-BEGIN:initComponents
78          jPanel1 = new javax.swing.JPanel();
79          jScrollPane1 = new javax.swing.JScrollPane();
80          txtDisplay = new javax.swing.JEditorPane();
81          jPanel2 = new javax.swing.JPanel();
82          jButton1 = new javax.swing.JButton();
83  
84          addWindowListener(new java.awt.event.WindowAdapter() {
85              public void windowClosing(java.awt.event.WindowEvent evt) {
86                  closeDialog(evt);
87              }
88          });
89  
90          jPanel1.setLayout(new java.awt.BorderLayout());
91  
92          jScrollPane1.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
93          txtDisplay.setContentType("text/html");
94          jScrollPane1.setViewportView(txtDisplay);
95  
96          jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER);
97  
98          jButton1.setText("Okay");
99          jButton1.addActionListener(new java.awt.event.ActionListener() {
100             public void actionPerformed(java.awt.event.ActionEvent evt) {
101                 jButton1ActionPerformed(evt);
102             }
103         });
104 
105         jPanel2.add(jButton1);
106 
107         jPanel1.add(jPanel2, java.awt.BorderLayout.NORTH);
108 
109         getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
110 
111         pack();
112     }//GEN-END:initComponents
113 
114     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
115         this.dispose();
116     }//GEN-LAST:event_jButton1ActionPerformed
117 
118     /** Closes the dialog */
119     private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
120         setVisible(false);
121         dispose();
122     }//GEN-LAST:event_closeDialog
123 
124     /**
125     * @param args the command line arguments
126     */
127     public static void main(String args[]) {
128         new r2Readme(new javax.swing.JFrame(), true).show();
129     }
130 
131 
132     // Variables declaration - do not modify//GEN-BEGIN:variables
133     private javax.swing.JPanel jPanel2;
134     private javax.swing.JPanel jPanel1;
135     private javax.swing.JButton jButton1;
136     private javax.swing.JEditorPane txtDisplay;
137     private javax.swing.JScrollPane jScrollPane1;
138     // End of variables declaration//GEN-END:variables
139 
140 }