KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > install > Setup_Help


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2002 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.install;
15
16 import java.awt.*;
17 import java.awt.event.*;
18 import javax.swing.*;
19 import javax.swing.border.*;
20 import java.io.*;
21 import java.util.ResourceBundle JavaDoc;
22
23 import org.compiere.apps.OnlineHelp;
24
25 /**
26  * Setup Online Help
27  *
28  * @author Jorg Janke
29  * @version $Id: Setup_Help.java,v 1.1 2003/03/15 07:06:12 jjanke Exp $
30  */

31 public class Setup_Help extends JDialog implements ActionListener
32 {
33     /**
34      * Constructor
35      * @param parent parent frame
36      */

37     public Setup_Help (Frame parent)
38     {
39         super (parent, true);
40         init(parent);
41     } // Setup_Help
42

43     /**
44      * Constructor
45      * @param parent parent dialog
46      */

47     public Setup_Help (Dialog parent)
48     {
49         super (parent, true);
50         init(parent);
51     } // Setup_Help
52

53     /**
54      * Constructor init
55      * @param parent parent window
56      */

57     private void init (Window parent)
58     {
59         enableEvents(AWTEvent.WINDOW_EVENT_MASK);
60         try
61         {
62             jbInit();
63             dynInit();
64         }
65         catch(Exception JavaDoc e)
66         {
67             e.printStackTrace();
68         }
69
70         Dimension dlgSize = getPreferredSize();
71         Dimension frmSize = parent.getSize();
72         Point loc = parent.getLocation();
73         setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
74         try
75         {
76             pack();
77             show(); // HTML load errors
78
}
79         catch (Exception JavaDoc ex)
80         {
81         }
82     } // init
83

84
85     static ResourceBundle JavaDoc res = ResourceBundle.getBundle("org.compiere.install.SetupRes");
86     private JPanel mainPanel = new JPanel();
87     private JPanel southPanel = new JPanel();
88     private JButton bOK = new JButton();
89     private BorderLayout mainLayout = new BorderLayout();
90     private JScrollPane centerScrollPane = new JScrollPane();
91     private JEditorPane editorPane = new OnlineHelp();
92
93
94     /**
95      * Static layout
96      * @throws Exception
97      */

98     private void jbInit() throws Exception JavaDoc
99     {
100         //imageLabel.setIcon(new ImageIcon(SetupFrame_AboutBox.class.getResource("[Your Image]")));
101
this.setTitle(res.getString("CompiereServerSetup") + " " + res.getString("Help"));
102         mainPanel.setLayout(mainLayout);
103         bOK.setText(res.getString("Ok"));
104         bOK.addActionListener(this);
105         centerScrollPane.setPreferredSize(new Dimension(400, 400));
106         this.getContentPane().add(mainPanel, null);
107         southPanel.add(bOK, null);
108         mainPanel.add(southPanel, BorderLayout.SOUTH);
109         setResizable(true);
110         mainPanel.add(centerScrollPane, BorderLayout.CENTER);
111         centerScrollPane.getViewport().add(editorPane, null);
112     } // jbInit
113

114     /**
115      * Set Content
116      */

117     private void dynInit()
118     {
119         try
120         {
121             editorPane.setPage("http://www.compiere.org/help/serverSetup.html");
122         }
123         catch (IOException ex)
124         {
125             editorPane.setText(res.getString("PleaseCheck")
126                 + " http://www.compiere.org/support <p>("
127                 + res.getString("UnableToConnect") + ")");
128         }
129     } // dynInit
130

131     /**
132      * Close Dialog if closing
133      * @param e event
134      */

135     protected void processWindowEvent(WindowEvent e)
136     {
137         if (e.getID() == WindowEvent.WINDOW_CLOSING)
138             dispose();
139         super.processWindowEvent(e);
140     } // processWindowEvent
141

142     /**
143      * Action Listener
144      * @param e event
145      */

146     public void actionPerformed(ActionEvent e)
147     {
148         if (e.getSource() == bOK)
149             dispose();
150     } // actionPerformed
151

152 } // Setup_Help
153
Popular Tags