KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > quikj > application > utilities > postinstall > HelpFrame


1 /*
2  * HelpFrame.java
3  *
4  * Created on July 3, 2003, 11:27 AM
5  */

6
7 package com.quikj.application.utilities.postinstall;
8
9 import java.awt.*;
10
11 /**
12  *
13  * @author amit
14  */

15 public class HelpFrame extends java.awt.Frame JavaDoc
16 {
17     
18     /** Creates new form HelpFrame */
19     public HelpFrame(Frame parent)
20     {
21         initComponents();
22         
23         Rectangle pbounds = parent.getBounds();
24         Point mid = new Point(pbounds.x + pbounds.width, pbounds.y);
25         Rectangle bounds = getBounds();
26         setBounds(mid.x, mid.y, bounds.width, bounds.height);
27         
28         instance = this;
29     }
30     
31     public static HelpFrame getInstance()
32     {
33         return instance;
34     }
35     
36     public void setText(String JavaDoc text)
37     {
38         helpArea.setText(text);
39         
40         if (isShowing() == false)
41         {
42             show();
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     private void initComponents()//GEN-BEGIN:initComponents
52
{
53         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
54
55         helpArea = new TextArea("", 20, 70, TextArea.SCROLLBARS_VERTICAL_ONLY);
56         button1 = new java.awt.Button JavaDoc();
57
58         setLayout(new java.awt.GridBagLayout JavaDoc());
59
60         setTitle("Ace Operator Post-Installation Help");
61         addWindowListener(new java.awt.event.WindowAdapter JavaDoc()
62         {
63             public void windowClosing(java.awt.event.WindowEvent JavaDoc evt)
64             {
65                 exitForm(evt);
66             }
67         });
68
69         helpArea.setEditable(false);
70         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
71         gridBagConstraints.gridx = 0;
72         gridBagConstraints.gridy = 0;
73         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
74         gridBagConstraints.insets = new java.awt.Insets JavaDoc(10, 10, 10, 10);
75         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
76         gridBagConstraints.weightx = 100.0;
77         gridBagConstraints.weighty = 100.0;
78         add(helpArea, gridBagConstraints);
79
80         button1.setLabel("Close");
81         button1.addActionListener(new java.awt.event.ActionListener JavaDoc()
82         {
83             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt)
84             {
85                 button1ActionPerformed(evt);
86             }
87         });
88
89         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
90         gridBagConstraints.gridx = 0;
91         gridBagConstraints.gridy = 1;
92         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
93         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 10, 10, 10);
94         gridBagConstraints.weightx = 100.0;
95         add(button1, gridBagConstraints);
96
97         pack();
98     }//GEN-END:initComponents
99

100     private void button1ActionPerformed(java.awt.event.ActionEvent JavaDoc evt)//GEN-FIRST:event_button1ActionPerformed
101
{//GEN-HEADEREND:event_button1ActionPerformed
102
// Add your handling code here:
103
hide();
104     }//GEN-LAST:event_button1ActionPerformed
105

106     /** Exit the Application */
107     private void exitForm(java.awt.event.WindowEvent JavaDoc evt)
108     {//GEN-FIRST:event_exitForm
109
hide();
110     }//GEN-LAST:event_exitForm
111

112     // Variables declaration - do not modify//GEN-BEGIN:variables
113
private java.awt.Button JavaDoc button1;
114     private java.awt.TextArea JavaDoc helpArea;
115     // End of variables declaration//GEN-END:variables
116

117     private static HelpFrame instance = null;
118 }
119
Popular Tags