KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbforms > devgui > HelpFrame


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/devgui/HelpFrame.java,v 1.6 2004/08/18 12:25:57 hkollmann Exp $
3  * $Revision: 1.6 $
4  * $Date: 2004/08/18 12:25:57 $
5  *
6  * DbForms - a Rapid Application Development Framework
7  * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */

23
24 package org.dbforms.devgui;
25
26
27 /**
28  * DOCUMENT ME!
29  *
30  * @author $author$
31  * @version $Revision: 1.6 $
32  */

33 public class HelpFrame extends javax.swing.JFrame JavaDoc {
34    private javax.swing.JButton JavaDoc closeBtn;
35    private javax.swing.JEditorPane JavaDoc jEditorPane1;
36    private javax.swing.JPanel JavaDoc jPanel4;
37
38    //GEN-LAST:event_exitForm
39
// Variables declaration - do not modify//GEN-BEGIN:variables
40
private javax.swing.JScrollPane JavaDoc jScrollPane1;
41
42    /**
43     * Creates new form HelpFrame
44     */

45    public HelpFrame() {
46       initComponents();
47
48       String JavaDoc dbFormsHomeStr = System.getProperty("DBFORMS_HOME");
49
50       if (dbFormsHomeStr != null) {
51          String JavaDoc fileSeparator = System.getProperties()
52                                       .getProperty("file.separator");
53          String JavaDoc helpfilename = dbFormsHomeStr + fileSeparator + "doc"
54                                + fileSeparator + "devgui" + fileSeparator
55                                + "devgui.html";
56
57          try {
58             jEditorPane1.setPage("file:" + helpfilename);
59             setTitle("Helpfile: " + helpfilename);
60          } catch (Exception JavaDoc ex) {
61             jEditorPane1.setText("Error: could not load helpfile '"
62                                  + helpfilename + "'\n" + ex.getMessage());
63          }
64
65          pack();
66       }
67
68       this.setSize(520, 500);
69    }
70
71    //GEN-END:initComponents
72
private void closeBtnActionPerformed(java.awt.event.ActionEvent JavaDoc evt) { //GEN-FIRST:event_closeBtnActionPerformed
73
this.setVisible(false);
74    }
75
76
77    //GEN-LAST:event_closeBtnActionPerformed
78

79    /**
80     * Exit the Application
81     *
82     * @param evt DOCUMENT ME!
83     */

84    private void exitForm(java.awt.event.WindowEvent JavaDoc evt) { //GEN-FIRST:event_exitForm
85
this.setVisible(false);
86    }
87
88
89    /**
90     * This method is called from within the constructor to initialize the form.
91     * WARNING: Do NOT modify this code. The content of this method is always
92     * regenerated by the Form Editor.
93     */

94    private void initComponents() { //GEN-BEGIN:initComponents
95
jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
96       jEditorPane1 = new javax.swing.JEditorPane JavaDoc();
97       jPanel4 = new javax.swing.JPanel JavaDoc();
98       closeBtn = new javax.swing.JButton JavaDoc();
99
100       setTitle("DevGui Help");
101       addWindowListener(new java.awt.event.WindowAdapter JavaDoc() {
102             public void windowClosing(java.awt.event.WindowEvent JavaDoc evt) {
103                exitForm(evt);
104             }
105          });
106
107       jScrollPane1.setMinimumSize(new java.awt.Dimension JavaDoc(150, 200));
108       jEditorPane1.setEditable(false);
109       jScrollPane1.setViewportView(jEditorPane1);
110
111       getContentPane()
112          .add(jScrollPane1, java.awt.BorderLayout.CENTER);
113
114       closeBtn.setToolTipText("Close help window");
115       closeBtn.setText("Close");
116       closeBtn.addActionListener(new java.awt.event.ActionListener JavaDoc() {
117             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
118                closeBtnActionPerformed(evt);
119             }
120          });
121
122       jPanel4.add(closeBtn);
123
124       getContentPane()
125          .add(jPanel4, java.awt.BorderLayout.SOUTH);
126
127       pack();
128    }
129
130    // End of variables declaration//GEN-END:variables
131
}
132
Popular Tags