Booking confirmation and e-mail service added. Some bugs to be solved.
[RRRRHHHH_Code] / ruralHouses / src / gui / StartWindow.java
1 package gui;
2
3 /**
4  * @author willCodeForFood
5  */
6 import java.awt.Color;
7 import java.awt.Font;
8 import java.awt.event.WindowAdapter;
9 import java.awt.event.WindowEvent;
10 import java.rmi.RMISecurityManager;
11
12 import javax.swing.JButton;
13 import javax.swing.JFrame;
14 import javax.swing.JLabel;
15 import javax.swing.JPanel;
16 import javax.swing.SwingConstants;
17 import javax.swing.UIManager;
18
19 import configuration.ConfigXML;
20
21
22 @SuppressWarnings("deprecation")
23 public class StartWindow extends JFrame {
24         
25         private static final long serialVersionUID = 1L;
26
27         private JPanel jContentPane = null;
28         private JButton boton2 = null;
29         private JButton boton3 = null;
30         private static configuration.ConfigXML c;
31
32         //public static ApplicationFacadeInterface facadeInterface;
33         private JLabel lblNewLabel;
34         
35         public static void main(String[] args) {
36
37                 StartWindow a = new StartWindow();
38                 a.setVisible(true);
39                 
40                 try {
41
42                         c=ConfigXML.getInstance();
43
44                         System.setProperty("java.security.policy", c.getJavaPolicyPath());
45                                                 
46                         System.setSecurityManager(new RMISecurityManager());
47
48                         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
49
50                         c=configuration.ConfigXML.getInstance();
51
52                 }catch (com.db4o.ext.DatabaseFileLockedException e) {
53                         a.lblNewLabel.setText("Database locked: Do not run BusinessLogicServer or BusinessLogicServer!!");
54                         a.lblNewLabel.setForeground(Color.RED);         
55                         System.out.println("Error in StartWindow: "+e.toString());
56                 } catch (Exception e) {
57                         a.lblNewLabel.setText("Error: "+e.toString());
58                         a.lblNewLabel.setForeground(Color.RED);         
59                         System.out.println("Error in StartWindow: "+e.toString());
60                 }
61
62                 
63
64         }
65         /**
66          * This is the default constructor
67          */
68
69         public StartWindow() {
70                 super();
71
72                 addWindowListener(new WindowAdapter() {
73                         @Override
74                         public void windowClosing(WindowEvent e) {
75
76                                 System.exit(1);
77                         }
78                 });
79                 initialize();
80                 //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
81         }
82         
83         
84
85         /**
86          * This method initializes this
87          * 
88          * @return void
89          */
90         private void initialize() {
91                 // this.setSize(271, 295);
92                 this.setSize(495, 290);
93                 this.setContentPane(getJContentPane());
94                 this.setTitle("Rural Houses");
95         }
96
97         /**
98          * This method initializes jContentPane
99          * 
100          * @return javax.swing.JPanel
101          */
102         private JPanel getJContentPane() {
103                 if (jContentPane == null) {
104                         jContentPane = new JPanel();
105                         jContentPane.setLayout(null);
106                         jContentPane.add(getLblNewLabel());
107                         jContentPane.add(getBoton2());
108                         jContentPane.add(getBoton3());
109                 }
110                 return jContentPane;
111         }
112
113         /**
114          * This method initializes boton2
115          * 
116          * @return javax.swing.JButton
117          */
118         private JButton getBoton2() {
119                 if (boton2 == null) {
120                         boton2 = new JButton();
121                         boton2.setBounds(0, 74, 479, 93);
122                         boton2.setText("Login");
123                         boton2.addActionListener(new java.awt.event.ActionListener() {
124                                 public void actionPerformed(java.awt.event.ActionEvent e) {
125                                         // C?digo cedido por la universidad
126                                         JFrame a = new LoginGUI();
127                                         a.setVisible(true);
128                                 }
129                         });
130                 }
131                 return boton2;
132         }
133         
134         /**
135          * This method initializes boton3
136          * 
137          * @return javax.swing.JButton
138          */
139         private JButton getBoton3() {
140                 if (boton3 == null) {
141                         boton3 = new JButton();
142                         boton3.setBounds(0, 165, 479, 87);
143                         boton3.setText("Query availability");
144                         boton3.addActionListener(new java.awt.event.ActionListener() {
145                                 public void actionPerformed(java.awt.event.ActionEvent e) {
146                                         // C?digo cedido por la universidad
147                                         //JFrame a = new QueryAvailabilityWindow();
148                                         JFrame a = new QueryAvailabilityGUI2();
149
150                                         a.setVisible(true);
151                                 }
152                         });
153                 }
154                 return boton3;
155         }
156         
157
158         private JLabel getLblNewLabel() {
159                 if (lblNewLabel == null) {
160                         lblNewLabel = new JLabel("Select option:");
161                         lblNewLabel.setBounds(0, 0, 479, 63);
162                         lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 13));
163                         lblNewLabel.setForeground(Color.BLACK);
164                         lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
165                 }
166                 return lblNewLabel;
167         }
168
169 } // @jve:decl-index=0:visual-constraint="0,0"
170