Repository: Link to Repository
- Java
- Eclipse
- Biblioteca JCalendar
- MySql
- Plugin WindowBuilder
☕ Use Java version 8 or higher for compatibility.
📝 We recommend using Eclipse IDE for compatibility with the graphical interface.
🎨 The interface contains two important methods:
setResizable(false): sets the window size, and with the parameter false, the screen cannot be maximized. setLocationRelativeTo(null): sets the window location, and with the parameter null, it keeps the window centered on the screen.
For this challenge, focus on the logical part and the database connection. After completing the challenge, feel free to add new features and modify the graphical interface.
src/imagenes: folder with images that you can use in your project. Feel free to use others if you prefer.
1 - Fork the project. In the top right corner, by clicking on the icon, a repository of the project will be created in your personal GitHub account.
2 - Once you have the forked repository in your account, verify if the page URL corresponds to your own repository account.
3 - Click on the Code option. Three ways to install the repository on your machine will be displayed, and we highlight two:
1 - To clone, simply copy the highlighted URL in the image located just below the HTTPS. Create a folder on your computer, open the cmd or Git Bash within that folder, and then enter the command git clone. Right-click inside the terminal and click on the Paste option to paste the URL, then press Enter.
2 - The second option is to download the code as a zipped package and extract the folder to your computer.
1 - Once inside the Editor on the left side, click on the Files in the menu at the top, choose the Open Projects from File System.
Then click Directory and locate the Directory of the "cloned" or "extracted" project on your computer. Click Finish to complete the import.
2 - The second way to import is in File in the Import option. Or through Project Explorer click on the empty field with the right mouse button and choose the Import option.
If you choose the Import option, the corresponding window will open. Click on the Existing Projects Into Workspace option and then click the Next button.
Then click the Browse button and browse for the project in the local directory.
After importing it into your editor, it is necessary to install the JCalendar library. Otherwise, the project will show an error and it won't be possible to open the Reservas window.
To install it, you need to download the package through this link: 🔹 Link para el JCalendar
The next step is to extract the files to a folder and import the files from the lib folder to a local folder and import the files into Eclipse.
lib folder files:
Right-click on the project located in the Package Explorer, choose the Build Path option, and then select Configure Build Path.
The project will have an error message indicating that the library path does not exist on your computer. Click on Libraries, then in Classpath select the JCalendar file, choose the Remove option, and click on Apply and Close.
To import the JCalendar from your computer, after extracting the downloaded files, click on ClassPath and then on Add External JARS. Add them one by one or select all at once, and click on Apply and Close.
Therefore, the project must contain the following files after imports:
By cloning or downloading the base project and having the JCalendar installed, you will have this presentation when running the project in Eclipse:
If your project has errors like the ones in the image, follow the steps below:
Go to Window and click on Preferences.
Then click on General and then on Workspace. If your Text File Encoding is not set to Default (UTF-8), click on Other, choose the UTF-8 option, and finish by clicking on Apply and Close.
It is the same path described to import the JCalendar. Right-click on the project, Build Path, Configure Build Path, Libraries, Add External JARs. To find the path of this .jar file, go to your computer's hard drive and enter the Program Files (x86) folder.
- Program Files (x86):
- MySQL
- Connector J 8.0:
- My SQL Connector Java:
For this challenge, we propose two tables: Reservas (Bookings) and Huéspedes (Guests). The Huéspedes table should contain the foreign key idReserva (booking ID).
In the Eclipse menu, go to the Help tab and select the Eclipse Marketplace option.
In the search bar, enter window builder and click on Go. After the search, select the first option and click on Install.
In the next window, select the Confirm button.
Click on the option to accept the Terms of Use, and finally, click on Finish to complete.
After the installation, it will be necessary to restart Eclipse.
Once you have completed the challenge, if you want to explore the Window Builder and add new windows or change the design of existing ones, click on the .java file, then on Open With, and finally on Window Builder Editor.
The Design tab will open above the Console area. Here, you can unleash the artist within you!