4 * @author willCodeForFood
8 import java.awt.event.WindowAdapter;
9 import java.awt.event.WindowEvent;
10 import java.rmi.RMISecurityManager;
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;
19 import configuration.ConfigXML;
22 public class StartWindow extends JFrame {
24 private static final long serialVersionUID = 1L;
26 private JPanel jContentPane = null;
27 private JButton boton2 = null;
28 private JButton boton3 = null;
29 private static configuration.ConfigXML c;
31 //public static ApplicationFacadeInterface facadeInterface;
32 private JLabel lblNewLabel;
34 public static void main(String[] args) {
36 StartWindow a = new StartWindow();
41 c=ConfigXML.getInstance();
43 System.setProperty("java.security.policy", c.getJavaPolicyPath());
45 System.setSecurityManager(new RMISecurityManager());
47 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
49 c=configuration.ConfigXML.getInstance();
50 if (c.isBusinessLogicLocal()){
51 //facadeInterface=new FacadeImplementation();
55 final String businessLogicNode = c.getBusinessLogicNode();
56 // Remote service name
57 String serviceName = "/"+c.getServiceRMI();
58 // RMI server port number
59 int portNumber = Integer.parseInt(c.getPortRMI());
60 // RMI server host IP IP
61 /*facadeInterface = (ApplicationFacadeInterface) Naming.lookup("rmi://"
62 + businessLogicNode + ":" + portNumber + serviceName);*/
65 }/* catch (java.rmi.ConnectException e) {
66 a.lblNewLabel.setText("No business logic: Run BusinessLogicServer first!!");
67 a.lblNewLabel.setForeground(Color.RED);
68 System.out.println("Error in StartWindow: "+e.toString());
69 } catch (java.rmi.NotBoundException e) {
70 a.lblNewLabel.setText("No business logic: Maybe problems running BusinessLogicServer");
71 a.lblNewLabel.setForeground(Color.RED);
72 System.out.println("Error in StartWindow: "+e.toString());
73 } */catch (com.db4o.ext.DatabaseFileLockedException e) {
74 a.lblNewLabel.setText("Database locked: Do not run BusinessLogicServer or BusinessLogicServer!!");
75 a.lblNewLabel.setForeground(Color.RED);
76 System.out.println("Error in StartWindow: "+e.toString());
77 } catch (Exception e) {
78 a.lblNewLabel.setText("Error: "+e.toString());
79 a.lblNewLabel.setForeground(Color.RED);
80 System.out.println("Error in StartWindow: "+e.toString());
88 * This is the default constructor
91 public StartWindow() {
94 addWindowListener(new WindowAdapter() {
96 public void windowClosing(WindowEvent e) {
101 //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
107 * This method initializes this
111 private void initialize() {
112 // this.setSize(271, 295);
113 this.setSize(495, 290);
114 this.setContentPane(getJContentPane());
115 this.setTitle("Rural Houses");
119 * This method initializes jContentPane
121 * @return javax.swing.JPanel
123 private JPanel getJContentPane() {
124 if (jContentPane == null) {
125 jContentPane = new JPanel();
126 jContentPane.setLayout(null);
127 jContentPane.add(getLblNewLabel());
128 jContentPane.add(getBoton2());
129 jContentPane.add(getBoton3());
135 * This method initializes boton2
137 * @return javax.swing.JButton
139 private JButton getBoton2() {
140 if (boton2 == null) {
141 boton2 = new JButton();
142 boton2.setBounds(0, 74, 479, 93);
143 boton2.setText("Login");
144 boton2.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 LoginGUI();
156 * This method initializes boton3
158 * @return javax.swing.JButton
160 private JButton getBoton3() {
161 if (boton3 == null) {
162 boton3 = new JButton();
163 boton3.setBounds(0, 165, 479, 87);
164 boton3.setText("Query availability");
165 boton3.addActionListener(new java.awt.event.ActionListener() {
166 public void actionPerformed(java.awt.event.ActionEvent e) {
167 // C?digo cedido por la universidad
168 //JFrame a = new QueryAvailabilityWindow();
169 JFrame a = new QueryAvailabilityGUI2();
179 private JLabel getLblNewLabel() {
180 if (lblNewLabel == null) {
181 lblNewLabel = new JLabel("Select option:");
182 lblNewLabel.setBounds(0, 0, 479, 63);
183 lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 13));
184 lblNewLabel.setForeground(Color.BLACK);
185 lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
190 } // @jve:decl-index=0:visual-constraint="0,0"