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;
20 import domain.Administrator;
23 public class StartWindow extends JFrame {
25 private static final long serialVersionUID = 1L;
27 private JPanel jContentPane = null;
28 private JButton boton2 = null;
29 private JButton boton3 = null;
30 private static configuration.ConfigXML c;
32 //public static ApplicationFacadeInterface facadeInterface;
33 private JLabel lblNewLabel;
35 public static void main(String[] args) {
37 StartWindow a = new StartWindow();
42 c=ConfigXML.getInstance();
44 System.setProperty("java.security.policy", c.getJavaPolicyPath());
46 System.setSecurityManager(new RMISecurityManager());
48 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
50 c=configuration.ConfigXML.getInstance();
51 if (c.isBusinessLogicLocal()){
52 //facadeInterface=new FacadeImplementation();
56 final String businessLogicNode = c.getBusinessLogicNode();
57 // Remote service name
58 String serviceName = "/"+c.getServiceRMI();
59 // RMI server port number
60 int portNumber = Integer.parseInt(c.getPortRMI());
61 // RMI server host IP IP
62 /*facadeInterface = (ApplicationFacadeInterface) Naming.lookup("rmi://"
63 + businessLogicNode + ":" + portNumber + serviceName);*/
66 }/* catch (java.rmi.ConnectException e) {
67 a.lblNewLabel.setText("No business logic: Run BusinessLogicServer first!!");
68 a.lblNewLabel.setForeground(Color.RED);
69 System.out.println("Error in StartWindow: "+e.toString());
70 } catch (java.rmi.NotBoundException e) {
71 a.lblNewLabel.setText("No business logic: Maybe problems running BusinessLogicServer");
72 a.lblNewLabel.setForeground(Color.RED);
73 System.out.println("Error in StartWindow: "+e.toString());
74 } */catch (com.db4o.ext.DatabaseFileLockedException e) {
75 a.lblNewLabel.setText("Database locked: Do not run BusinessLogicServer or BusinessLogicServer!!");
76 a.lblNewLabel.setForeground(Color.RED);
77 System.out.println("Error in StartWindow: "+e.toString());
78 } catch (Exception e) {
79 a.lblNewLabel.setText("Error: "+e.toString());
80 a.lblNewLabel.setForeground(Color.RED);
81 System.out.println("Error in StartWindow: "+e.toString());
89 * This is the default constructor
92 public StartWindow() {
95 addWindowListener(new WindowAdapter() {
97 public void windowClosing(WindowEvent e) {
103 //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
109 * This method initializes this
113 private void initialize() {
114 // this.setSize(271, 295);
115 this.setSize(495, 290);
116 this.setContentPane(getJContentPane());
117 this.setTitle("Rural Houses");
121 * This method initializes jContentPane
123 * @return javax.swing.JPanel
125 private JPanel getJContentPane() {
126 if (jContentPane == null) {
127 jContentPane = new JPanel();
128 jContentPane.setLayout(null);
129 jContentPane.add(getLblNewLabel());
130 jContentPane.add(getBoton2());
131 jContentPane.add(getBoton3());
137 * This method initializes boton2
139 * @return javax.swing.JButton
141 private JButton getBoton2() {
142 if (boton2 == null) {
143 boton2 = new JButton();
144 boton2.setBounds(0, 74, 479, 93);
145 boton2.setText("Login");
146 boton2.addActionListener(new java.awt.event.ActionListener() {
147 public void actionPerformed(java.awt.event.ActionEvent e) {
148 // C?digo cedido por la universidad
149 JFrame a = new LoginGUI();
158 * This method initializes boton3
160 * @return javax.swing.JButton
162 private JButton getBoton3() {
163 if (boton3 == null) {
164 boton3 = new JButton();
165 boton3.setBounds(0, 165, 479, 87);
166 boton3.setText("Query availability");
167 boton3.addActionListener(new java.awt.event.ActionListener() {
168 public void actionPerformed(java.awt.event.ActionEvent e) {
169 // C?digo cedido por la universidad
170 //JFrame a = new QueryAvailabilityWindow();
171 JFrame a = new QueryAvailabilityGUI2();
181 private JLabel getLblNewLabel() {
182 if (lblNewLabel == null) {
183 lblNewLabel = new JLabel("Select option:");
184 lblNewLabel.setBounds(0, 0, 479, 63);
185 lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 13));
186 lblNewLabel.setForeground(Color.BLACK);
187 lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
192 } // @jve:decl-index=0:visual-constraint="0,0"