4 * @author willCodeForFood
6 import exceptions.DB4oManagerCreationException;
10 import configuration.ConfigXML;
12 import java.awt.Color;
14 import java.awt.Rectangle;
15 import java.awt.Dimension;
16 import java.awt.BorderLayout;
17 import java.awt.FlowLayout;
18 import java.awt.GridLayout;
19 import java.awt.GridBagLayout;
20 import java.awt.GridBagConstraints;
21 import java.awt.event.WindowAdapter;
22 import java.awt.event.WindowEvent;
25 public class StartWindow extends JFrame {
27 private static final long serialVersionUID = 1L;
29 private JPanel jContentPane = null;
30 private JButton boton2 = null;
31 private JButton boton3 = null;
32 private static configuration.ConfigXML c;
34 //public static ApplicationFacadeInterface facadeInterface;
35 private JLabel lblNewLabel;
37 public static void main(String[] args) {
39 StartWindow a = new StartWindow();
44 c=ConfigXML.getInstance();
46 System.setProperty("java.security.policy", c.getJavaPolicyPath());
48 System.setSecurityManager(new RMISecurityManager());
50 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
52 c=configuration.ConfigXML.getInstance();
53 if (c.isBusinessLogicLocal()){
54 //facadeInterface=new FacadeImplementation();
58 final String businessLogicNode = c.getBusinessLogicNode();
59 // Remote service name
60 String serviceName = "/"+c.getServiceRMI();
61 // RMI server port number
62 int portNumber = Integer.parseInt(c.getPortRMI());
63 // RMI server host IP IP
64 /*facadeInterface = (ApplicationFacadeInterface) Naming.lookup("rmi://"
65 + businessLogicNode + ":" + portNumber + serviceName);*/
68 }/* catch (java.rmi.ConnectException e) {
69 a.lblNewLabel.setText("No business logic: Run BusinessLogicServer first!!");
70 a.lblNewLabel.setForeground(Color.RED);
71 System.out.println("Error in StartWindow: "+e.toString());
72 } catch (java.rmi.NotBoundException e) {
73 a.lblNewLabel.setText("No business logic: Maybe problems running BusinessLogicServer");
74 a.lblNewLabel.setForeground(Color.RED);
75 System.out.println("Error in StartWindow: "+e.toString());
76 } */catch (com.db4o.ext.DatabaseFileLockedException e) {
77 a.lblNewLabel.setText("Database locked: Do not run BusinessLogicServer or BusinessLogicServer!!");
78 a.lblNewLabel.setForeground(Color.RED);
79 System.out.println("Error in StartWindow: "+e.toString());
80 } catch (Exception e) {
81 a.lblNewLabel.setText("Error: "+e.toString());
82 a.lblNewLabel.setForeground(Color.RED);
83 System.out.println("Error in StartWindow: "+e.toString());
91 * This is the default constructor
94 public StartWindow() {
97 addWindowListener(new WindowAdapter() {
99 public void windowClosing(WindowEvent e) {
104 //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
110 * This method initializes this
114 private void initialize() {
115 // this.setSize(271, 295);
116 this.setSize(495, 290);
117 this.setContentPane(getJContentPane());
118 this.setTitle("Rural Houses");
122 * This method initializes jContentPane
124 * @return javax.swing.JPanel
126 private JPanel getJContentPane() {
127 if (jContentPane == null) {
128 jContentPane = new JPanel();
129 jContentPane.setLayout(null);
130 jContentPane.add(getLblNewLabel());
131 jContentPane.add(getBoton2());
132 jContentPane.add(getBoton3());
138 * This method initializes boton2
140 * @return javax.swing.JButton
142 private JButton getBoton2() {
143 if (boton2 == null) {
144 boton2 = new JButton();
145 boton2.setBounds(0, 74, 479, 93);
146 boton2.setText("Login");
147 boton2.addActionListener(new java.awt.event.ActionListener() {
148 public void actionPerformed(java.awt.event.ActionEvent e) {
149 // C?digo cedido por la universidad
150 JFrame a = new LoginGUI();
159 * This method initializes boton3
161 * @return javax.swing.JButton
163 private JButton getBoton3() {
164 if (boton3 == null) {
165 boton3 = new JButton();
166 boton3.setBounds(0, 165, 479, 87);
167 boton3.setText("Query availability");
168 boton3.addActionListener(new java.awt.event.ActionListener() {
169 public void actionPerformed(java.awt.event.ActionEvent e) {
170 // C?digo cedido por la universidad
171 //JFrame a = new QueryAvailabilityWindow();
172 JFrame a = new QueryAvailabilityGUI2();
182 private JLabel getLblNewLabel() {
183 if (lblNewLabel == null) {
184 lblNewLabel = new JLabel("Select option:");
185 lblNewLabel.setBounds(0, 0, 479, 63);
186 lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 13));
187 lblNewLabel.setForeground(Color.BLACK);
188 lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
193 } // @jve:decl-index=0:visual-constraint="0,0"