4 * @author willCodeForFood
8 import java.awt.KeyEventDispatcher;
9 import java.awt.KeyboardFocusManager;
10 import java.awt.event.KeyEvent;
11 import java.awt.event.WindowAdapter;
12 import java.awt.event.WindowEvent;
13 import java.rmi.RMISecurityManager;
15 import javax.swing.JButton;
16 import javax.swing.JFrame;
17 import javax.swing.JLabel;
18 import javax.swing.JPanel;
19 import javax.swing.SwingConstants;
20 import javax.swing.UIManager;
22 import configuration.ConfigXML;
24 @SuppressWarnings("deprecation")
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();
41 System.setProperty("java.security.policy", "java.policy");
47 c = ConfigXML.getInstance();
49 System.setProperty("java.security.policy", c.getJavaPolicyPath());
51 System.setSecurityManager(new RMISecurityManager());
53 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
55 c = configuration.ConfigXML.getInstance();
57 } catch (com.db4o.ext.DatabaseFileLockedException e) {
59 .setText("Database locked: Do not run BusinessLogicServer or BusinessLogicServer!!");
60 a.lblNewLabel.setForeground(Color.RED);
61 System.out.println("Error in StartWindow: " + e.toString());
62 } catch (Exception e) {
63 a.lblNewLabel.setText("Error: " + e.toString());
64 a.lblNewLabel.setForeground(Color.RED);
65 System.out.println("Error in StartWindow: " + e.toString());
71 * This is the default constructor
74 public StartWindow() {
77 addWindowListener(new WindowAdapter() {
79 public void windowClosing(WindowEvent e) {
86 KeyboardFocusManager.getCurrentKeyboardFocusManager()
87 .addKeyEventDispatcher(new KeyEventDispatcher() {
90 public boolean dispatchKeyEvent(KeyEvent e) {
91 switch (e.getKeyCode()) {
93 case KeyEvent.VK_ESCAPE:
101 // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
105 * This method initializes this
109 private void initialize() {
110 // this.setSize(271, 295);
111 this.setSize(495, 290);
112 this.setContentPane(getJContentPane());
113 this.setTitle("Rural Houses");
117 * This method initializes jContentPane
119 * @return javax.swing.JPanel
121 private JPanel getJContentPane() {
122 if (jContentPane == null) {
123 jContentPane = new JPanel();
124 jContentPane.setLayout(null);
125 jContentPane.add(getLblNewLabel());
126 jContentPane.add(getBoton2());
127 jContentPane.add(getBoton3());
133 * This method initializes boton2
135 * @return javax.swing.JButton
137 private JButton getBoton2() {
138 if (boton2 == null) {
139 boton2 = new JButton();
140 boton2.setBounds(0, 74, 479, 93);
141 boton2.setText("Login");
142 boton2.addActionListener(new java.awt.event.ActionListener() {
143 public void actionPerformed(java.awt.event.ActionEvent e) {
144 // C?digo cedido por la universidad
145 JFrame a = new LoginGUI();
154 * This method initializes boton3
156 * @return javax.swing.JButton
158 private JButton getBoton3() {
159 if (boton3 == null) {
160 boton3 = new JButton();
161 boton3.setBounds(0, 165, 479, 87);
162 boton3.setText("Query availability");
163 boton3.addActionListener(new java.awt.event.ActionListener() {
164 public void actionPerformed(java.awt.event.ActionEvent e) {
165 // C?digo cedido por la universidad
166 // JFrame a = new QueryAvailabilityWindow();
167 JFrame a = new QueryAvailabilityGUI2();
176 private JLabel getLblNewLabel() {
177 if (lblNewLabel == null) {
178 lblNewLabel = new JLabel("Select option:");
179 lblNewLabel.setBounds(0, 0, 479, 63);
180 lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 13));
181 lblNewLabel.setForeground(Color.BLACK);
182 lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
187 } // @jve:decl-index=0:visual-constraint="0,0"