KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.*;
19
20 import javax.swing.*;
21
22 /**
23  * Setup Dialog Frame
24  *
25  * @author Jorg Janke
26  * @version $Id: Setup.java,v 1.2 2003/06/10 14:46:53 jjanke Exp $
27  */

28 public class Setup extends JFrame implements ActionListener
29 {
30     /**
31      * Constructor
32      */

33     public Setup()
34     {
35         enableEvents(AWTEvent.WINDOW_EVENT_MASK);
36         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
37         try
38         {
39             jbInit();
40         }
41         catch(Exception JavaDoc e)
42         {
43             e.printStackTrace();
44             System.exit(1);
45         }
46
47         /** Make visible **/
48         pack();
49         //Center the window
50
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
51         Dimension frameSize = this.getSize();
52         if (frameSize.height > screenSize.height)
53             frameSize.height = screenSize.height;
54         if (frameSize.width > screenSize.width)
55             frameSize.width = screenSize.width;
56         setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
57         setVisible(true);
58     } // Setup
59

60
61     // Static UI
62
static ResourceBundle res = ResourceBundle.getBundle("org.compiere.install.SetupRes");
63     private JPanel contentPane;
64     private JMenuBar menuBar = new JMenuBar();
65     private JMenu menuFile = new JMenu();
66     private JMenuItem menuFileExit = new JMenuItem();
67     private JMenu menuHelp = new JMenu();
68     private JMenuItem menuHelpInfo = new JMenuItem();
69     private JLabel statusBar = new JLabel();
70     private BorderLayout borderLayout = new BorderLayout();
71     private JPanel configurationPanel = new JPanel();
72
73     /**
74      * Static Init
75      * @throws Exception
76      */

77     private void jbInit() throws Exception JavaDoc
78     {
79         //setIconImage(Toolkit.getDefaultToolkit().createImage(SetupFrame.class.getResource("[Your Icon]")));
80
contentPane = (JPanel) this.getContentPane();
81         contentPane.setLayout(borderLayout);
82         configurationPanel = new ConfigurationPanel(statusBar);
83
84         this.setTitle(res.getString("CompiereServerSetup"));
85         statusBar.setBorder(BorderFactory.createLoweredBevelBorder());
86         statusBar.setText(" ");
87         menuFile.setText(res.getString("File"));
88         menuFileExit.setText(res.getString("Exit"));
89         menuFileExit.addActionListener(this);
90         menuHelp.setText(res.getString("Help"));
91         menuHelpInfo.setText(res.getString("Help"));
92         menuHelpInfo.addActionListener(this);
93         borderLayout.setHgap(5);
94         borderLayout.setVgap(5);
95         menuFile.add(menuFileExit);
96         menuHelp.add(menuHelpInfo);
97         menuBar.add(menuFile);
98         menuBar.add(menuHelp);
99         this.setJMenuBar(menuBar);
100         contentPane.add(statusBar, BorderLayout.SOUTH);
101         contentPane.add(configurationPanel, BorderLayout.CENTER);
102     } // jbInit
103

104     /**
105      * ActionListener
106      * @param e event
107      */

108     public void actionPerformed(ActionEvent e)
109     {
110         if (e.getSource() == menuFileExit)
111             System.exit(0);
112         else if (e.getSource() == menuHelpInfo)
113             new Setup_Help(this);
114     } // actionPerformed
115

116
117     /**
118      * Start
119      * @param args ignored
120      */

121     public static void main(String JavaDoc[] args)
122     {
123     // System.out.println(Compiere.getSummaryAscii());
124
new Setup();
125     } // main
126

127 } // Setup
128
Popular Tags