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;
33 private JLabel lblNewLabel;
35 public static void main(String[] args) {
37 StartWindow a = new StartWindow();
39 System.setProperty("java.security.policy", "java.policy");
45 c = ConfigXML.getInstance();
47 System.setProperty("java.security.policy", c.getJavaPolicyPath());
49 System.setSecurityManager(new RMISecurityManager());
51 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
53 c = configuration.ConfigXML.getInstance();
55 } catch (com.db4o.ext.DatabaseFileLockedException e) {
57 .setText("Database locked: Do not run BusinessLogicServer or BusinessLogicServer!!");
58 a.lblNewLabel.setForeground(Color.RED);
59 System.out.println("Error in StartWindow: " + e.toString());
60 } catch (Exception e) {
61 a.lblNewLabel.setText("Error: " + e.toString());
62 a.lblNewLabel.setForeground(Color.RED);
63 System.out.println("Error in StartWindow: " + e.toString());
69 * This is the default constructor
72 public StartWindow() {
75 addWindowListener(new WindowAdapter() {
77 public void windowClosing(WindowEvent e) {
84 KeyboardFocusManager.getCurrentKeyboardFocusManager()
85 .addKeyEventDispatcher(new KeyEventDispatcher() {
88 public boolean dispatchKeyEvent(KeyEvent e) {
89 switch (e.getKeyCode()) {
91 case KeyEvent.VK_ESCAPE:
99 // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
103 * This method initializes this
107 private void initialize() {
108 // this.setSize(271, 295);
109 this.setSize(495, 290);
110 this.setContentPane(getJContentPane());
111 this.setTitle("Rural Houses");
115 * This method initializes jContentPane
117 * @return javax.swing.JPanel
119 private JPanel getJContentPane() {
120 if (jContentPane == null) {
121 jContentPane = new JPanel();
122 jContentPane.setLayout(null);
123 jContentPane.add(getLblNewLabel());
124 jContentPane.add(getBoton2());
125 jContentPane.add(getBoton3());
131 * This method initializes boton2
133 * @return javax.swing.JButton
135 private JButton getBoton2() {
136 if (boton2 == null) {
137 boton2 = new JButton();
138 boton2.setBounds(0, 74, 479, 93);
139 boton2.setText("Login");
140 boton2.addActionListener(new java.awt.event.ActionListener() {
141 public void actionPerformed(java.awt.event.ActionEvent e) {
142 // C?digo cedido por la universidad
143 JFrame a = new LoginGUI();
152 * This method initializes boton3
154 * @return javax.swing.JButton
156 private JButton getBoton3() {
157 if (boton3 == null) {
158 boton3 = new JButton();
159 boton3.setBounds(0, 165, 479, 87);
160 boton3.setText("Query availability");
161 boton3.addActionListener(new java.awt.event.ActionListener() {
162 public void actionPerformed(java.awt.event.ActionEvent e) {
163 // C?digo cedido por la universidad
164 // JFrame a = new QueryAvailabilityWindow();
165 JFrame a = new QueryAvailabilityGUI2();
174 private JLabel getLblNewLabel() {
175 if (lblNewLabel == null) {
176 lblNewLabel = new JLabel("Select option:");
177 lblNewLabel.setBounds(0, 0, 479, 63);
178 lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 13));
179 lblNewLabel.setForeground(Color.BLACK);
180 lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
185 } // @jve:decl-index=0:visual-constraint="0,0"