commit 4f98db0ad1b18c74b46266c053f39e64fafe5a6f Author: devfzn Date: Fri Aug 18 11:39:27 2023 -0400 init Challenge Hotel Alura proyecto base diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e12a3c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.env +.classpath +.project +.settings/ +bin/ +target/*/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..c1c0109 --- /dev/null +++ b/README.md @@ -0,0 +1,132 @@ +

+ +# Challenge ONE - Hotel Alura + +[ToC] + +### 🖥️ Tecnologías Utilizadas + +- Java v17 +- Eclipse +- Plugin WindowBuilder +- MySql +- Biblioteca JCalendar +- Biblioteca Dotenv + +> **Note** Para este desafío, concéntrate en la parte lógica y la conexión +con la base de datos, después de completar el desafío, siéntete libre de +agregar nuevas funciones y modificar la interfaz gráfica. + + +### Proyeto base + +Github [Hotel Alura](https://github.com/alura-challenges/challenge-one-alura-hotel-latam) + +:small_orange_diamond: `src/views` Directorio con la interfaz gráfica +necesaria para el programa +:small_orange_diamond: `src/imagenes` Directorio con imágenes a usar en el +proyecto + +### Requerimientos + +- Sistema de autenticación de usuario para que solo usuarios autorizados accedan +al sistema +- Permitir crear, editar y eliminar una reserva para los clientes +- Buscar en la base de datos toda la informacion tanto de clientes como reservas +- Registrar, editar y eliminar datos de huéspedes +- Calcular el valor de la reserva en base a la cantidad de de días de hospedaje +y al valor diario. Asignar en la moneda local de tu país; p.e. una reserva de 3 +dias con valor diario de $20, serian $60, todo esto deberá ser hecho +automaticamente y mostrado al usuario antes de guardar la reserva +- Base de datos para almacenar todos los datos pedidos anteriormente. +- Ahora te preguntarás ¿Cómo se que datos debo registrar? Para eso el líder del +proyecto puso a disposición un Diagrama de Entidad Relación que usaremos para +crear las tablas en nuestra base de Datos y que está anexado a esta tarjeta +y que también estará como una tarea en nuestro backlog. No olvides leer todas +las tarjetas. +- Periodo de tiempo de cuatro semanas para desarrollar el proyecto y por eso en +esta oportunidad se facilota la parte visual del proyecto, para centrar el +desarrollo de la lógica y funcionamiento, puedes hacer las modificaciones que +creas convenientes, y se trabaja usando el sistema ágil de desarrollo utilizando +Trello + +## :construction: Proyecto + +### :bar_chart: Base de Datos + +Archivo `.env` con credenciales para conexión con base de datos, en raíz del +proyecto + +```txt +📂 . +├── 📁 .git +├── 📁 .settings +├── 📁 bin +├── 📁 src +├── 📁 target +├── .classpath +├── .env <---- Dotenv file +├── .gitignore +├── .project +├── pom.xml +└── README.md +``` + +Contenido de `.env` + +```conf +# Database credentials +DBADDR=address +DBNAME=database +DBUSER=user +DBPASS=password +``` + +#### Modelo entidad relación + +- **`huesped`** +- **`reserva`** clave externa (***foreign key***) **idReserva** + +```mermaid +erDiagram + Huesped ||--|{ Reserva : tiene + Huesped { + Id int PK "NN NB" + Nombre varchar "bla bla" + Apellido varchar "bla bla" + Fecha_Nacimiento date "1931-12-20" + Nacionalidad varchar "CL" + Telefono varchar + Id_Reserva int FK "bla bla" + } + + Reserva { + Id int PK "NN NB" + Fecha_Entrada date "1931-12-20" + Fecha_Salida date "1931-12-20" + Valor int FK "bla bla" + Forma_Pago varchar "cheque" + } +``` + +### 🗔 Plugin WindowBuilder + +- Explorar *Window Builder*, agregar nuevas ventanas, o cambiar el diseño +de las existentes, haz clic en el archivo **java**, luego en *Open With* -> +*Window Builder Editor* + +### :mailbox_with_mail: Entrega + +1. Utilizar topico **challengeonehotelaluralatam4** en *About* -> *topics* -> +etiqueta **challengeonehotelaluralatam4** +2. Rellenar formulario de entrega con el enlace al repositorio +[Link formulario](https://lp.alura.com.br/alura-latam-entrega-challenge-one-esp-back-end) +3. ¡Añadir enlace y/o video del proyecto en Linkedin! Etiqueta a `#Oracle` y +`#AluraLatam` :checkered_flag: + +🧡 Oracle
+[](https://www.linkedin.com/company/oracle/) + +💙 Alura Latam
+[](https://www.linkedin.com/company/alura-latam/mycompany/) + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..b4f7a70 --- /dev/null +++ b/pom.xml @@ -0,0 +1,63 @@ + + 4.0.0 + hotel_alura + hotel_alura + 0.0.1-SNAPSHOT + + + mysql + mysql-connector-java + 8.0.33 + + + com.mchange + c3p0 + 0.9.5.5 + + + com.mchange + mchange-commons-java + 0.2.20 + + + com.toedter + jcalendar + 1.4 + + + com.jgoodies + jgoodies-common + 1.8.1 + + + com.jgoodies + jgoodies-looks + 2.7.0 + + + junit + junit + 4.13.2 + test + + + io.github.cdimascio + dotenv-java + 3.0.0 + + + + src + + + maven-compiler-plugin + 3.8.1 + + 17 + + + + + \ No newline at end of file diff --git a/src/cl/com/alura/hotel/pruebas/PruebaConexion.java b/src/cl/com/alura/hotel/pruebas/PruebaConexion.java new file mode 100644 index 0000000..7a9c026 --- /dev/null +++ b/src/cl/com/alura/hotel/pruebas/PruebaConexion.java @@ -0,0 +1,31 @@ +package cl.com.alura.hotel.pruebas; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +import io.github.cdimascio.dotenv.Dotenv; + +public class PruebaConexion { + + private static String dbaddr; + private static String dbname; + private static String dbuser; + private static String dbpass; + private final static String driver = "jdbc:mysql://"; + private final static String params = "?useTimeZone=true&serverTimeZone=UTC"; + + public static void main(String[] args) throws SQLException { + Dotenv dotenv = Dotenv.load(); + dbname = dotenv.get("DBNAME"); + dbaddr = dotenv.get("DBADDR"); + dbuser = dotenv.get("DBUSER"); + dbpass = dotenv.get("DBPASS"); + final String dburl = driver + dbaddr + "/" + dbname + params; + System.out.println("Iniciando conexión con DB: " + dburl); + Connection con = DriverManager.getConnection(dburl, dbuser, dbpass); + con.close(); + System.out.println("Conexión con DB cerrada!"); + } + +} \ No newline at end of file diff --git a/src/cl/com/alura/hotel/pruebas/PruebaDotEnv.java b/src/cl/com/alura/hotel/pruebas/PruebaDotEnv.java new file mode 100644 index 0000000..e977165 --- /dev/null +++ b/src/cl/com/alura/hotel/pruebas/PruebaDotEnv.java @@ -0,0 +1,17 @@ +package cl.com.alura.hotel.pruebas; + +import io.github.cdimascio.dotenv.Dotenv; +import io.github.cdimascio.dotenv.DotenvException; + +public class PruebaDotEnv { + + public static void main(String[] args) { + try { + Dotenv dotenv = Dotenv.load(); + System.out.println(dotenv.get("DBUSER")); + } catch (DotenvException e) { + System.out.println("Archivo .env no enconrado en raíz del proyecto"); + } + } + +} diff --git a/src/cl/com/alura/hotel/views/Busqueda.java b/src/cl/com/alura/hotel/views/Busqueda.java new file mode 100644 index 0000000..c9194cf --- /dev/null +++ b/src/cl/com/alura/hotel/views/Busqueda.java @@ -0,0 +1,278 @@ +package cl.com.alura.hotel.views; + +import java.awt.EventQueue; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.border.EmptyBorder; +import javax.swing.table.DefaultTableModel; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.JButton; +import javax.swing.ImageIcon; +import java.awt.Color; +import java.awt.SystemColor; +import javax.swing.JLabel; +import java.awt.Font; +import java.awt.event.ActionListener; +import java.util.List; +import java.awt.event.ActionEvent; +import javax.swing.JTabbedPane; +import java.awt.Toolkit; +import javax.swing.SwingConstants; +import javax.swing.JSeparator; +import javax.swing.ListSelectionModel; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; + +public class Busqueda extends JFrame { + + private static final long serialVersionUID = 1L; + private JPanel contentPane; + private JTextField txtBuscar; + private JTable tbHuespedes; + private JTable tbReservas; + private DefaultTableModel modelo; + private DefaultTableModel modeloHuesped; + private JLabel labelAtras; + private JLabel labelExit; + int xMouse, yMouse; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + Busqueda frame = new Busqueda(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public Busqueda() { + setIconImage(Toolkit.getDefaultToolkit().getImage(Busqueda.class.getResource("/imagenes/lupa2.png"))); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 910, 571); + contentPane = new JPanel(); + contentPane.setBackground(Color.WHITE); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(null); + setLocationRelativeTo(null); + setUndecorated(true); + + txtBuscar = new JTextField(); + txtBuscar.setBounds(536, 127, 193, 31); + txtBuscar.setBorder(javax.swing.BorderFactory.createEmptyBorder()); + contentPane.add(txtBuscar); + txtBuscar.setColumns(10); + + JLabel lblNewLabel_4 = new JLabel("SISTEMA DE BÚSQUEDA"); + lblNewLabel_4.setForeground(new Color(12, 138, 199)); + lblNewLabel_4.setFont(new Font("Roboto Black", Font.BOLD, 24)); + lblNewLabel_4.setBounds(331, 62, 280, 42); + contentPane.add(lblNewLabel_4); + + JTabbedPane panel = new JTabbedPane(JTabbedPane.TOP); + panel.setBackground(new Color(12, 138, 199)); + panel.setFont(new Font("Roboto", Font.PLAIN, 16)); + panel.setBounds(20, 169, 865, 328); + contentPane.add(panel); + + tbReservas = new JTable(); + tbReservas.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + tbReservas.setFont(new Font("Roboto", Font.PLAIN, 16)); + modelo = (DefaultTableModel) tbReservas.getModel(); + modelo.addColumn("Numero de Reserva"); + modelo.addColumn("Fecha Check In"); + modelo.addColumn("Fecha Check Out"); + modelo.addColumn("Valor"); + modelo.addColumn("Forma de Pago"); + JScrollPane scroll_table = new JScrollPane(tbReservas); + panel.addTab("Reservas", new ImageIcon(Busqueda.class.getResource("/imagenes/reservado.png")), scroll_table, + null); + scroll_table.setVisible(true); + + tbHuespedes = new JTable(); + tbHuespedes.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + tbHuespedes.setFont(new Font("Roboto", Font.PLAIN, 16)); + modeloHuesped = (DefaultTableModel) tbHuespedes.getModel(); + modeloHuesped.addColumn("Número de Huesped"); + modeloHuesped.addColumn("Nombre"); + modeloHuesped.addColumn("Apellido"); + modeloHuesped.addColumn("Fecha de Nacimiento"); + modeloHuesped.addColumn("Nacionalidad"); + modeloHuesped.addColumn("Telefono"); + modeloHuesped.addColumn("Número de Reserva"); + JScrollPane scroll_tableHuespedes = new JScrollPane(tbHuespedes); + panel.addTab("Huéspedes", new ImageIcon(Busqueda.class.getResource("/imagenes/pessoas.png")), + scroll_tableHuespedes, null); + scroll_tableHuespedes.setVisible(true); + + JLabel lblNewLabel_2 = new JLabel(""); + lblNewLabel_2.setIcon(new ImageIcon(Busqueda.class.getResource("/imagenes/Ha-100px.png"))); + lblNewLabel_2.setBounds(56, 51, 104, 107); + contentPane.add(lblNewLabel_2); + + JPanel header = new JPanel(); + header.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseDragged(MouseEvent e) { + headerMouseDragged(e); + + } + }); + header.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + headerMousePressed(e); + } + }); + header.setLayout(null); + header.setBackground(Color.WHITE); + header.setBounds(0, 0, 910, 36); + contentPane.add(header); + + JPanel btnAtras = new JPanel(); + btnAtras.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + MenuUsuario usuario = new MenuUsuario(); + usuario.setVisible(true); + dispose(); + } + + @Override + public void mouseEntered(MouseEvent e) { + btnAtras.setBackground(new Color(12, 138, 199)); + labelAtras.setForeground(Color.white); + } + + @Override + public void mouseExited(MouseEvent e) { + btnAtras.setBackground(Color.white); + labelAtras.setForeground(Color.black); + } + }); + btnAtras.setLayout(null); + btnAtras.setBackground(Color.WHITE); + btnAtras.setBounds(0, 0, 53, 36); + header.add(btnAtras); + + labelAtras = new JLabel("<"); + labelAtras.setHorizontalAlignment(SwingConstants.CENTER); + labelAtras.setFont(new Font("Roboto", Font.PLAIN, 23)); + labelAtras.setBounds(0, 0, 53, 36); + btnAtras.add(labelAtras); + + JPanel btnexit = new JPanel(); + btnexit.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + MenuUsuario usuario = new MenuUsuario(); + usuario.setVisible(true); + dispose(); + } + + @Override + public void mouseEntered(MouseEvent e) { // Al usuario pasar el mouse por el botón este cambiará de color + btnexit.setBackground(Color.red); + labelExit.setForeground(Color.white); + } + + @Override + public void mouseExited(MouseEvent e) { // Al usuario quitar el mouse por el botón este volverá al estado + // original + btnexit.setBackground(Color.white); + labelExit.setForeground(Color.black); + } + }); + btnexit.setLayout(null); + btnexit.setBackground(Color.WHITE); + btnexit.setBounds(857, 0, 53, 36); + header.add(btnexit); + + labelExit = new JLabel("X"); + labelExit.setHorizontalAlignment(SwingConstants.CENTER); + labelExit.setForeground(Color.BLACK); + labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); + labelExit.setBounds(0, 0, 53, 36); + btnexit.add(labelExit); + + JSeparator separator_1_2 = new JSeparator(); + separator_1_2.setForeground(new Color(12, 138, 199)); + separator_1_2.setBackground(new Color(12, 138, 199)); + separator_1_2.setBounds(539, 159, 193, 2); + contentPane.add(separator_1_2); + + JPanel btnbuscar = new JPanel(); + btnbuscar.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + + } + }); + btnbuscar.setLayout(null); + btnbuscar.setBackground(new Color(12, 138, 199)); + btnbuscar.setBounds(748, 125, 122, 35); + btnbuscar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + contentPane.add(btnbuscar); + + JLabel lblBuscar = new JLabel("BUSCAR"); + lblBuscar.setBounds(0, 0, 122, 35); + btnbuscar.add(lblBuscar); + lblBuscar.setHorizontalAlignment(SwingConstants.CENTER); + lblBuscar.setForeground(Color.WHITE); + lblBuscar.setFont(new Font("Roboto", Font.PLAIN, 18)); + + JPanel btnEditar = new JPanel(); + btnEditar.setLayout(null); + btnEditar.setBackground(new Color(12, 138, 199)); + btnEditar.setBounds(635, 508, 122, 35); + btnEditar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + contentPane.add(btnEditar); + + JLabel lblEditar = new JLabel("EDITAR"); + lblEditar.setHorizontalAlignment(SwingConstants.CENTER); + lblEditar.setForeground(Color.WHITE); + lblEditar.setFont(new Font("Roboto", Font.PLAIN, 18)); + lblEditar.setBounds(0, 0, 122, 35); + btnEditar.add(lblEditar); + + JPanel btnEliminar = new JPanel(); + btnEliminar.setLayout(null); + btnEliminar.setBackground(new Color(12, 138, 199)); + btnEliminar.setBounds(767, 508, 122, 35); + btnEliminar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + contentPane.add(btnEliminar); + + JLabel lblEliminar = new JLabel("ELIMINAR"); + lblEliminar.setHorizontalAlignment(SwingConstants.CENTER); + lblEliminar.setForeground(Color.WHITE); + lblEliminar.setFont(new Font("Roboto", Font.PLAIN, 18)); + lblEliminar.setBounds(0, 0, 122, 35); + btnEliminar.add(lblEliminar); + setResizable(false); + } + +//Código que permite mover la ventana por la pantalla según la posición de "x" y "y" + private void headerMousePressed(java.awt.event.MouseEvent evt) { + xMouse = evt.getX(); + yMouse = evt.getY(); + } + + private void headerMouseDragged(java.awt.event.MouseEvent evt) { + int x = evt.getXOnScreen(); + int y = evt.getYOnScreen(); + this.setLocation(x - xMouse, y - yMouse); + } +} diff --git a/src/cl/com/alura/hotel/views/Exito.java b/src/cl/com/alura/hotel/views/Exito.java new file mode 100644 index 0000000..f0119b4 --- /dev/null +++ b/src/cl/com/alura/hotel/views/Exito.java @@ -0,0 +1,87 @@ +package cl.com.alura.hotel.views; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JLabel; +import javax.swing.ImageIcon; +import java.awt.Color; +import java.awt.Font; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import java.awt.SystemColor; +import java.awt.Toolkit; + +public class Exito extends JDialog { + + private static final long serialVersionUID = 1L; + private final JPanel contentPanel = new JPanel(); + + /** + * Launch the application. + */ + public static void main(String[] args) { + try { + Exito dialog = new Exito(); + dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Create the dialog. + */ + public Exito() { + setIconImage(Toolkit.getDefaultToolkit().getImage(Exito.class.getResource("/imagenes/aH-40px.png"))); + setBounds(100, 100, 394, 226); + getContentPane().setLayout(new BorderLayout()); + contentPanel.setBackground(SystemColor.control); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel, BorderLayout.CENTER); + setLocationRelativeTo(null); + contentPanel.setLayout(null); + { + JLabel lblNewLabel = new JLabel(""); + lblNewLabel.setIcon(new ImageIcon(Exito.class.getResource("/imagenes/Ha-100px.png"))); + lblNewLabel.setBounds(123, 11, 100, 100); + contentPanel.add(lblNewLabel); + } + { + JLabel lblNewLabel_1 = new JLabel("Datos guardados satisfactoriamente"); + lblNewLabel_1.setForeground(new Color(12, 138, 199)); + lblNewLabel_1.setFont(new Font("Arial", Font.BOLD, 18)); + lblNewLabel_1.setBounds(27, 122, 322, 21); + contentPanel.add(lblNewLabel_1); + } + { + JPanel buttonPane = new JPanel(); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane, BorderLayout.SOUTH); + { + JButton okButton = new JButton("OK"); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + dispose();// sirve para cerrar la ventana actual + MenuUsuario usuario = new MenuUsuario(); + usuario.setVisible(true); + } + }); + okButton.setActionCommand("OK"); + buttonPane.add(okButton); + getRootPane().setDefaultButton(okButton); + } + { + JButton cancelButton = new JButton("Cancel"); + cancelButton.setActionCommand("Cancel"); + buttonPane.add(cancelButton); + } + } + } + +} diff --git a/src/cl/com/alura/hotel/views/Login.java b/src/cl/com/alura/hotel/views/Login.java new file mode 100644 index 0000000..c91c6c3 --- /dev/null +++ b/src/cl/com/alura/hotel/views/Login.java @@ -0,0 +1,264 @@ +package cl.com.alura.hotel.views; + +import java.awt.EventQueue; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import java.awt.Color; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.ImageIcon; +import javax.swing.JTextField; +import javax.swing.JSeparator; +import java.awt.SystemColor; +import java.awt.Font; +import javax.swing.JPasswordField; +import javax.swing.SwingConstants; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; + +public class Login extends JFrame { + + /** + * + */ + private static final long serialVersionUID = 1L; + private JPanel contentPane; + private JTextField txtUsuario; + private JPasswordField txtContrasena; + int xMouse, yMouse; + private JLabel labelExit; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + Login frame = new Login(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public Login() { + setResizable(false); + setUndecorated(true); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 788, 527); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(null); + setLocationRelativeTo(null); + + JPanel panel = new JPanel(); + panel.setBounds(0, 0, 788, 527); + panel.setBackground(Color.WHITE); + contentPane.add(panel); + panel.setLayout(null); + + JPanel panel_1 = new JPanel(); + panel_1.setBackground(new Color(12, 138, 199)); + panel_1.setBounds(484, 0, 304, 527); + panel.add(panel_1); + panel_1.setLayout(null); + + JLabel imgHotel = new JLabel(""); + imgHotel.setBounds(0, 0, 304, 538); + panel_1.add(imgHotel); + imgHotel.setIcon(new ImageIcon(Login.class.getResource("/imagenes/img-hotel-login-.png"))); + + JPanel btnexit = new JPanel(); + btnexit.setBounds(251, 0, 53, 36); + panel_1.add(btnexit); + btnexit.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + System.exit(0); + } + + @Override + public void mouseEntered(MouseEvent e) { + btnexit.setBackground(Color.red); + labelExit.setForeground(Color.white); + } + + @Override + public void mouseExited(MouseEvent e) { + btnexit.setBackground(new Color(12, 138, 199)); + labelExit.setForeground(Color.white); + } + }); + btnexit.setBackground(new Color(12, 138, 199)); + btnexit.setLayout(null); + btnexit.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + + labelExit = new JLabel("X"); + labelExit.setBounds(0, 0, 53, 36); + btnexit.add(labelExit); + labelExit.setForeground(SystemColor.text); + labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); + labelExit.setHorizontalAlignment(SwingConstants.CENTER); + + txtUsuario = new JTextField(); + txtUsuario.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + if (txtUsuario.getText().equals("Ingrese su nombre de usuario")) { + txtUsuario.setText(""); + txtUsuario.setForeground(Color.black); + } + if (String.valueOf(txtContrasena.getPassword()).isEmpty()) { + txtContrasena.setText("********"); + txtContrasena.setForeground(Color.gray); + } + } + }); + txtUsuario.setFont(new Font("Roboto", Font.PLAIN, 16)); + txtUsuario.setText("Ingrese su nombre de usuario"); + txtUsuario.setBorder(javax.swing.BorderFactory.createEmptyBorder()); + txtUsuario.setForeground(SystemColor.activeCaptionBorder); + txtUsuario.setBounds(65, 256, 324, 32); + panel.add(txtUsuario); + txtUsuario.setColumns(10); + + JSeparator separator = new JSeparator(); + separator.setBackground(new Color(0, 120, 215)); + separator.setBounds(65, 292, 324, 2); + panel.add(separator); + + JLabel labelTitulo = new JLabel("INICIAR SESIÓN"); + labelTitulo.setForeground(SystemColor.textHighlight); + labelTitulo.setFont(new Font("Roboto Black", Font.PLAIN, 26)); + labelTitulo.setBounds(65, 149, 202, 26); + panel.add(labelTitulo); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBackground(SystemColor.textHighlight); + separator_1.setBounds(65, 393, 324, 2); + panel.add(separator_1); + + txtContrasena = new JPasswordField(); + txtContrasena.setText("********"); + txtContrasena.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + if (String.valueOf(txtContrasena.getPassword()).equals("********")) { + txtContrasena.setText(""); + txtContrasena.setForeground(Color.black); + } + if (txtUsuario.getText().isEmpty()) { + txtUsuario.setText("Ingrese su nombre de usuario"); + txtUsuario.setForeground(Color.gray); + } + } + }); + txtContrasena.setForeground(SystemColor.activeCaptionBorder); + txtContrasena.setFont(new Font("Roboto", Font.PLAIN, 16)); + txtContrasena.setBorder(javax.swing.BorderFactory.createEmptyBorder()); + txtContrasena.setBounds(65, 353, 324, 32); + panel.add(txtContrasena); + + JLabel LabelUsuario = new JLabel("USUARIO"); + LabelUsuario.setForeground(SystemColor.textInactiveText); + LabelUsuario.setFont(new Font("Roboto Black", Font.PLAIN, 20)); + LabelUsuario.setBounds(65, 219, 107, 26); + panel.add(LabelUsuario); + + JLabel lblContrasea = new JLabel("CONTRASEÑA"); + lblContrasea.setForeground(SystemColor.textInactiveText); + lblContrasea.setFont(new Font("Roboto Black", Font.PLAIN, 20)); + lblContrasea.setBounds(65, 316, 140, 26); + panel.add(lblContrasea); + + JPanel btnLogin = new JPanel(); + btnLogin.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + btnLogin.setBackground(new Color(0, 156, 223)); + } + + @Override + public void mouseExited(MouseEvent e) { + btnLogin.setBackground(SystemColor.textHighlight); + } + + @Override + public void mouseClicked(MouseEvent e) { + Login(); + } + }); + btnLogin.setBackground(SystemColor.textHighlight); + btnLogin.setBounds(65, 431, 122, 44); + panel.add(btnLogin); + btnLogin.setLayout(null); + btnLogin.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + + JLabel lblNewLabel = new JLabel("ENTRAR"); + lblNewLabel.setBounds(0, 0, 122, 44); + btnLogin.add(lblNewLabel); + lblNewLabel.setForeground(SystemColor.controlLtHighlight); + lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); + lblNewLabel.setFont(new Font("Roboto", Font.PLAIN, 18)); + + JLabel lblNewLabel_1 = new JLabel(""); + lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER); + lblNewLabel_1.setIcon(new ImageIcon(Login.class.getResource("/imagenes/lOGO-50PX.png"))); + lblNewLabel_1.setBounds(65, 65, 48, 59); + panel.add(lblNewLabel_1); + + JPanel header = new JPanel(); + header.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseDragged(MouseEvent e) { + headerMouseDragged(e); + + } + }); + header.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + headerMousePressed(e); + } + }); + header.setBackground(SystemColor.window); + header.setBounds(0, 0, 784, 36); + panel.add(header); + header.setLayout(null); + } + + private void Login() { + String Usuario = "admin"; + String Contraseña = "admin"; + + String contrase = new String(txtContrasena.getPassword()); + + if (txtUsuario.getText().equals(Usuario) && contrase.equals(Contraseña)) { + MenuUsuario menu = new MenuUsuario(); + menu.setVisible(true); + dispose(); + } else { + JOptionPane.showMessageDialog(this, "Usuario o Contraseña no válidos"); + } + } + + private void headerMousePressed(java.awt.event.MouseEvent evt) { + xMouse = evt.getX(); + yMouse = evt.getY(); + }// GEN-LAST:event_headerMousePressed + + private void headerMouseDragged(java.awt.event.MouseEvent evt) { + int x = evt.getXOnScreen(); + int y = evt.getYOnScreen(); + this.setLocation(x - xMouse, y - yMouse); + } +} diff --git a/src/cl/com/alura/hotel/views/MenuPrincipal.java b/src/cl/com/alura/hotel/views/MenuPrincipal.java new file mode 100644 index 0000000..0c9919b --- /dev/null +++ b/src/cl/com/alura/hotel/views/MenuPrincipal.java @@ -0,0 +1,180 @@ +package cl.com.alura.hotel.views; + +import java.awt.EventQueue; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import java.awt.Panel; +import java.awt.Color; +import java.awt.SystemColor; +import javax.swing.JLabel; +import javax.swing.ImageIcon; +import java.awt.Font; +import java.awt.Toolkit; +import javax.swing.SwingConstants; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; + +@SuppressWarnings("serial") +public class MenuPrincipal extends JFrame { + + private JPanel contentPane; + private JLabel labelExit; + int xMouse, yMouse; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + MenuPrincipal frame = new MenuPrincipal(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public MenuPrincipal() { + setIconImage(Toolkit.getDefaultToolkit().getImage(MenuPrincipal.class.getResource("/imagenes/aH-40px.png"))); + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + setBounds(100, 100, 910, 537); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(null); + setResizable(false); + setLocationRelativeTo(null); + setUndecorated(true); + + Panel panel = new Panel(); + panel.setBackground(SystemColor.window); + panel.setBounds(0, 0, 910, 537); + contentPane.add(panel); + panel.setLayout(null); + + JLabel imagenFondo = new JLabel(""); + imagenFondo.setBounds(-50, 0, 732, 501); + imagenFondo.setIcon(new ImageIcon(MenuPrincipal.class.getResource("/imagenes/menu-img.png"))); + panel.add(imagenFondo); + + JLabel logo = new JLabel(""); + logo.setBounds(722, 80, 150, 156); + logo.setIcon(new ImageIcon(MenuPrincipal.class.getResource("/imagenes/aH-150px.png"))); + panel.add(logo); + + JPanel panel_1 = new JPanel(); + panel_1.setBounds(0, 500, 910, 37); + panel_1.setBackground(new Color(12, 138, 199)); + panel.add(panel_1); + panel_1.setLayout(null); + + JLabel lblCopyR = new JLabel("Desarrollado por Fulanita de Tal © 2023"); + lblCopyR.setBounds(315, 11, 284, 19); + lblCopyR.setForeground(new Color(240, 248, 255)); + lblCopyR.setFont(new Font("Roboto", Font.PLAIN, 16)); + panel_1.add(lblCopyR); + + // Barra para controlar la ventana + JPanel header = new JPanel(); + header.setBounds(0, 0, 910, 36); + header.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseDragged(MouseEvent e) { + headerMouseDragged(e); + + } + }); + header.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + headerMousePressed(e); + } + }); + header.setLayout(null); + header.setBackground(Color.WHITE); + panel.add(header); + + // Botón salir + JPanel btnexit = new JPanel(); + btnexit.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + System.exit(0); + } + + @Override + public void mouseEntered(MouseEvent e) { + btnexit.setBackground(Color.red); + labelExit.setForeground(Color.white); + } + + @Override + public void mouseExited(MouseEvent e) { + btnexit.setBackground(Color.white); + labelExit.setForeground(Color.black); + } + }); + btnexit.setLayout(null); + btnexit.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + btnexit.setBackground(Color.WHITE); + btnexit.setBounds(857, 0, 53, 36); + header.add(btnexit); + + labelExit = new JLabel("X"); + labelExit.setBounds(0, 0, 53, 36); + btnexit.add(labelExit); + labelExit.setHorizontalAlignment(SwingConstants.CENTER); + labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); + + // Botón Login + JPanel btnLogin = new JPanel(); + btnLogin.setBounds(754, 300, 83, 70); + btnLogin.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + Login login = new Login(); + login.setVisible(true); + dispose(); + } + }); + btnLogin.setLayout(null); + btnLogin.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + btnLogin.setBackground(SystemColor.window); + panel.add(btnLogin); + + JLabel imagenLogin = new JLabel(""); + imagenLogin.setBounds(0, 0, 80, 70); + btnLogin.add(imagenLogin); + imagenLogin.setHorizontalAlignment(SwingConstants.CENTER); + imagenLogin.setIcon(new ImageIcon(MenuPrincipal.class.getResource("/imagenes/login.png"))); + + JLabel lblTitulo = new JLabel("LOGIN"); + lblTitulo.setBounds(754, 265, 83, 24); + lblTitulo.setBackground(SystemColor.window); + panel.add(lblTitulo); + lblTitulo.setHorizontalAlignment(SwingConstants.CENTER); + lblTitulo.setForeground(SystemColor.textHighlight); + lblTitulo.setFont(new Font("Roboto Light", Font.PLAIN, 20)); + } + + // Código que permite movimentar a janela pela tela seguindo a posição de "x" e + // "y" + private void headerMousePressed(java.awt.event.MouseEvent evt) { + xMouse = evt.getX(); + yMouse = evt.getY(); + } + + private void headerMouseDragged(java.awt.event.MouseEvent evt) { + int x = evt.getXOnScreen(); + int y = evt.getYOnScreen(); + this.setLocation(x - xMouse, y - yMouse); + } +} diff --git a/src/cl/com/alura/hotel/views/MenuUsuario.java b/src/cl/com/alura/hotel/views/MenuUsuario.java new file mode 100644 index 0000000..048503e --- /dev/null +++ b/src/cl/com/alura/hotel/views/MenuUsuario.java @@ -0,0 +1,257 @@ +package cl.com.alura.hotel.views; + +import java.awt.EventQueue; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JLabel; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import java.awt.Color; +import java.awt.Font; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.ActionEvent; +import java.awt.Toolkit; +import javax.swing.SwingConstants; +import java.awt.event.MouseMotionAdapter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.awt.SystemColor; +import javax.swing.JSeparator; + +@SuppressWarnings("serial") +public class MenuUsuario extends JFrame { + + private JPanel contentPane; + int xMouse, yMouse; + private JLabel labelExit; + private JLabel labelRegistro; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + MenuUsuario frame = new MenuUsuario(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public MenuUsuario() { + setIconImage(Toolkit.getDefaultToolkit().getImage(MenuUsuario.class.getResource("/imagenes/aH-40px.png"))); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 944, 609); + contentPane = new JPanel(); + contentPane.setBackground(Color.WHITE); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(null); + setResizable(false); + setLocationRelativeTo(null); + setUndecorated(true); + + JPanel header = new JPanel(); + header.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseDragged(MouseEvent e) { + headerMouseDragged(e); + } + }); + header.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + headerMousePressed(e); + } + }); + + JPanel panelMenu = new JPanel(); + panelMenu.setBackground(new Color(12, 138, 199)); + panelMenu.setBounds(0, 0, 257, 609); + contentPane.add(panelMenu); + panelMenu.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel(""); + lblNewLabel_2.setBounds(50, 58, 150, 150); + panelMenu.add(lblNewLabel_2); + lblNewLabel_2.setIcon(new ImageIcon(MenuUsuario.class.getResource("/imagenes/aH-150px.png"))); + + JPanel btnRegistro = new JPanel(); + btnRegistro.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + btnRegistro.setBackground(new Color(118, 187, 223)); + } + + @Override + public void mouseExited(MouseEvent e) { + btnRegistro.setBackground(new Color(12, 138, 199)); + } + + @Override + public void mouseClicked(MouseEvent e) { + ReservasView reservas = new ReservasView(); + reservas.setVisible(true); + dispose(); + } + }); + btnRegistro.setBounds(0, 255, 257, 56); + btnRegistro.setBackground(new Color(12, 138, 199)); + panelMenu.add(btnRegistro); + btnRegistro.setLayout(null); + + labelRegistro = new JLabel("Registro de reservas"); + labelRegistro.setIcon(new ImageIcon(MenuUsuario.class.getResource("/imagenes/reservado.png"))); + labelRegistro.setForeground(SystemColor.text); + labelRegistro.setBounds(25, 11, 205, 34); + labelRegistro.setFont(new Font("Roboto", Font.PLAIN, 18)); + labelRegistro.setHorizontalAlignment(SwingConstants.LEFT); + btnRegistro.add(labelRegistro); + + JPanel btnBusqueda = new JPanel(); + btnBusqueda.addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + btnBusqueda.setBackground(new Color(118, 187, 223)); + } + + @Override + public void mouseExited(MouseEvent e) { + btnBusqueda.setBackground(new Color(12, 138, 199)); + } + + @Override + public void mouseClicked(MouseEvent e) { + Busqueda busqueda = new Busqueda(); + busqueda.setVisible(true); + dispose(); + } + }); + btnBusqueda.setBounds(0, 312, 257, 56); + btnBusqueda.setBackground(new Color(12, 138, 199)); + panelMenu.add(btnBusqueda); + btnBusqueda.setLayout(null); + + JLabel lblBusquedaDeReservas = new JLabel("Búsqueda"); + lblBusquedaDeReservas.setIcon(new ImageIcon(MenuUsuario.class.getResource("/imagenes/pessoas.png"))); + lblBusquedaDeReservas.setBounds(27, 11, 200, 34); + lblBusquedaDeReservas.setHorizontalAlignment(SwingConstants.LEFT); + lblBusquedaDeReservas.setForeground(Color.WHITE); + lblBusquedaDeReservas.setFont(new Font("Roboto", Font.PLAIN, 18)); + btnBusqueda.add(lblBusquedaDeReservas); + + JSeparator separator = new JSeparator(); + separator.setBounds(26, 219, 201, 2); + panelMenu.add(separator); + header.setLayout(null); + header.setBackground(Color.WHITE); + header.setBounds(0, 0, 944, 36); + contentPane.add(header); + + JPanel btnexit = new JPanel(); + btnexit.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + System.exit(0); + } + + @Override + public void mouseEntered(MouseEvent e) { + btnexit.setBackground(Color.red); + labelExit.setForeground(Color.white); + } + + @Override + public void mouseExited(MouseEvent e) { + btnexit.setBackground(Color.white); + labelExit.setForeground(Color.black); + } + }); + + btnexit.setLayout(null); + btnexit.setBackground(Color.WHITE); + btnexit.setBounds(891, 0, 53, 36); + header.add(btnexit); + + labelExit = new JLabel("X"); + labelExit.setBounds(0, 0, 53, 36); + btnexit.add(labelExit); + labelExit.setHorizontalAlignment(SwingConstants.CENTER); + labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); + + JPanel panelFecha = new JPanel(); + panelFecha.setBackground(new Color(118, 187, 223)); + panelFecha.setBounds(256, 84, 688, 121); + contentPane.add(panelFecha); + panelFecha.setLayout(null); + + JLabel lblNewLabel_1 = new JLabel("Sistema de reservas Hotel Alura"); + lblNewLabel_1.setBounds(180, 11, 356, 42); + panelFecha.add(lblNewLabel_1); + lblNewLabel_1.setForeground(Color.WHITE); + lblNewLabel_1.setFont(new Font("Roboto", Font.PLAIN, 24)); + + JLabel labelFecha = new JLabel("New label"); + labelFecha.setBounds(35, 64, 294, 36); + panelFecha.add(labelFecha); + labelFecha.setForeground(Color.WHITE); + labelFecha.setFont(new Font("Roboto", Font.PLAIN, 33)); + Date fechaActual = new Date(); // fecha y hora actual + String fecha = new SimpleDateFormat("dd/MM/yyyy").format(fechaActual); // formatear la fecha en una cadena + labelFecha.setText("Hoy es " + fecha); // setear la representacion en cadena de la fecha + + JLabel lblNewLabel = new JLabel("Bienvenido"); + lblNewLabel.setFont(new Font("Roboto", Font.BOLD, 24)); + lblNewLabel.setBounds(302, 234, 147, 46); + contentPane.add(lblNewLabel); + + String textoDescripcion = "Sistema de reserva de hotel. Controle y administre de forma óptima y fácil
el flujo de reservas y de huespédes del hotel "; + JLabel labelDescripcion = new JLabel(textoDescripcion); + labelDescripcion.setFont(new Font("Roboto", Font.PLAIN, 17)); + + labelDescripcion.setBounds(312, 291, 598, 66); + contentPane.add(labelDescripcion); + + String textoDescripcion1 = " Esta herramienta le permitirá llevar un control completo y detallado de sus reservas y huéspedes, tendrá acceso a heramientas especiales para tareas específicas como lo son:"; + JLabel labelDescripcion_1 = new JLabel(textoDescripcion1); + labelDescripcion_1.setFont(new Font("Roboto", Font.PLAIN, 17)); + labelDescripcion_1.setBounds(311, 345, 569, 88); + contentPane.add(labelDescripcion_1); + + JLabel lblNewLabel_3 = new JLabel("- Registro de Reservas y Huéspedes"); + lblNewLabel_3.setFont(new Font("Roboto", Font.PLAIN, 17)); + lblNewLabel_3.setBounds(312, 444, 295, 27); + contentPane.add(lblNewLabel_3); + + JLabel lblNewLabel_3_1 = new JLabel("- Edición de Reservas y Huéspedes existentes"); + lblNewLabel_3_1.setFont(new Font("Roboto", Font.PLAIN, 17)); + lblNewLabel_3_1.setBounds(312, 482, 355, 27); + contentPane.add(lblNewLabel_3_1); + + JLabel lblNewLabel_3_2 = new JLabel("- Eliminar todo tipo de registros"); + lblNewLabel_3_2.setFont(new Font("Roboto", Font.PLAIN, 17)); + lblNewLabel_3_2.setBounds(312, 520, 295, 27); + contentPane.add(lblNewLabel_3_2); + } + + private void headerMousePressed(java.awt.event.MouseEvent evt) { + xMouse = evt.getX(); + yMouse = evt.getY(); + }// GEN-LAST:event_headerMousePressed + + private void headerMouseDragged(java.awt.event.MouseEvent evt) { + int x = evt.getXOnScreen(); + int y = evt.getYOnScreen(); + this.setLocation(x - xMouse, y - yMouse); + } +} diff --git a/src/cl/com/alura/hotel/views/RegistroHuesped.java b/src/cl/com/alura/hotel/views/RegistroHuesped.java new file mode 100644 index 0000000..e33ed96 --- /dev/null +++ b/src/cl/com/alura/hotel/views/RegistroHuesped.java @@ -0,0 +1,351 @@ +package cl.com.alura.hotel.views; + +import java.awt.EventQueue; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import javax.swing.JTextField; +import java.awt.Color; +import com.toedter.calendar.JDateChooser; +import javax.swing.JComboBox; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import java.awt.Font; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import java.awt.SystemColor; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.text.Format; +import java.awt.event.ActionEvent; +import java.awt.Toolkit; +import javax.swing.SwingConstants; +import javax.swing.JSeparator; + +@SuppressWarnings("serial") +public class RegistroHuesped extends JFrame { + + private JPanel contentPane; + private JTextField txtNombre; + private JTextField txtApellido; + private JTextField txtTelefono; + private JTextField txtNreserva; + private JDateChooser txtFechaN; + private JComboBox txtNacionalidad; + private JLabel labelExit; + private JLabel labelAtras; + int xMouse, yMouse; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + RegistroHuesped frame = new RegistroHuesped(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public RegistroHuesped() { + + setIconImage( + Toolkit.getDefaultToolkit().getImage(RegistroHuesped.class.getResource("/imagenes/lOGO-50PX.png"))); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 910, 634); + contentPane = new JPanel(); + contentPane.setBackground(SystemColor.text); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + setLocationRelativeTo(null); + setUndecorated(true); + contentPane.setLayout(null); + + JPanel header = new JPanel(); + header.setBounds(0, 0, 910, 36); + header.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseDragged(MouseEvent e) { + headerMouseDragged(e); + + } + }); + header.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + headerMousePressed(e); + } + }); + header.setLayout(null); + header.setBackground(SystemColor.text); + header.setOpaque(false); + header.setBounds(0, 0, 910, 36); + contentPane.add(header); + + JPanel btnAtras = new JPanel(); + btnAtras.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + ReservasView reservas = new ReservasView(); + reservas.setVisible(true); + dispose(); + } + + @Override + public void mouseEntered(MouseEvent e) { + btnAtras.setBackground(Color.white); + labelAtras.setForeground(Color.black); + } + + @Override + public void mouseExited(MouseEvent e) { + btnAtras.setBackground(new Color(12, 138, 199)); + labelAtras.setForeground(Color.white); + } + }); + btnAtras.setLayout(null); + btnAtras.setBackground(new Color(12, 138, 199)); + btnAtras.setBounds(0, 0, 53, 36); + header.add(btnAtras); + + labelAtras = new JLabel("<"); + labelAtras.setHorizontalAlignment(SwingConstants.CENTER); + labelAtras.setForeground(Color.WHITE); + labelAtras.setFont(new Font("Roboto", Font.PLAIN, 23)); + labelAtras.setBounds(0, 0, 53, 36); + btnAtras.add(labelAtras); + + txtNombre = new JTextField(); + txtNombre.setFont(new Font("Roboto", Font.PLAIN, 16)); + txtNombre.setBounds(560, 135, 285, 33); + txtNombre.setBackground(Color.WHITE); + txtNombre.setColumns(10); + txtNombre.setBorder(javax.swing.BorderFactory.createEmptyBorder()); + contentPane.add(txtNombre); + + txtApellido = new JTextField(); + txtApellido.setFont(new Font("Roboto", Font.PLAIN, 16)); + txtApellido.setBounds(560, 204, 285, 33); + txtApellido.setColumns(10); + txtApellido.setBackground(Color.WHITE); + txtApellido.setBorder(javax.swing.BorderFactory.createEmptyBorder()); + contentPane.add(txtApellido); + + txtFechaN = new JDateChooser(); + txtFechaN.setBounds(560, 278, 285, 36); + txtFechaN.getCalendarButton() + .setIcon(new ImageIcon(RegistroHuesped.class.getResource("/imagenes/icon-reservas.png"))); + txtFechaN.getCalendarButton().setBackground(SystemColor.textHighlight); + txtFechaN.setDateFormatString("yyyy-MM-dd"); + contentPane.add(txtFechaN); + + txtNacionalidad = new JComboBox(); + txtNacionalidad.setBounds(560, 350, 289, 36); + txtNacionalidad.setBackground(SystemColor.text); + txtNacionalidad.setFont(new Font("Roboto", Font.PLAIN, 16)); + txtNacionalidad.setModel(new DefaultComboBoxModel(new String[] { "afgano-afgana", "alemán-", "alemana", + "árabe-árabe", "argentino-argentina", "australiano-australiana", "belga-belga", "boliviano-boliviana", + "brasileño-brasileña", "camboyano-camboyana", "canadiense-canadiense", "chileno-chilena", "chino-china", + "colombiano-colombiana", "coreano-coreana", "costarricense-costarricense", "cubano-cubana", + "danés-danesa", "ecuatoriano-ecuatoriana", "egipcio-egipcia", "salvadoreño-salvadoreña", + "escocés-escocesa", "español-española", "estadounidense-estadounidense", "estonio-estonia", + "etiope-etiope", "filipino-filipina", "finlandés-finlandesa", "francés-francesa", "galés-galesa", + "griego-griega", "guatemalteco-guatemalteca", "haitiano-haitiana", "holandés-holandesa", + "hondureño-hondureña", "indonés-indonesa", "inglés-inglesa", "iraquí-iraquí", "iraní-iraní", + "irlandés-irlandesa", "israelí-israelí", "italiano-italiana", "japonés-japonesa", "jordano-jordana", + "laosiano-laosiana", "letón-letona", "letonés-letonesa", "malayo-malaya", "marroquí-marroquí", + "mexicano-mexicana", "nicaragüense-nicaragüense", "noruego-noruega", "neozelandés-neozelandesa", + "panameño-panameña", "paraguayo-paraguaya", "peruano-peruana", "polaco-polaca", "portugués-portuguesa", + "puertorriqueño-puertorriqueño", "dominicano-dominicana", "rumano-rumana", "ruso-rusa", "sueco-sueca", + "suizo-suiza", "tailandés-tailandesa", "taiwanes-taiwanesa", "turco-turca", "ucraniano-ucraniana", + "uruguayo-uruguaya", "venezolano-venezolana", "vietnamita-vietnamita" })); + contentPane.add(txtNacionalidad); + + JLabel lblNombre = new JLabel("NOMBRE"); + lblNombre.setBounds(562, 119, 253, 14); + lblNombre.setForeground(SystemColor.textInactiveText); + lblNombre.setFont(new Font("Roboto Black", Font.PLAIN, 18)); + contentPane.add(lblNombre); + + JLabel lblApellido = new JLabel("APELLIDO"); + lblApellido.setBounds(560, 189, 255, 14); + lblApellido.setForeground(SystemColor.textInactiveText); + lblApellido.setFont(new Font("Roboto Black", Font.PLAIN, 18)); + contentPane.add(lblApellido); + + JLabel lblFechaN = new JLabel("FECHA DE NACIMIENTO"); + lblFechaN.setBounds(560, 256, 255, 14); + lblFechaN.setForeground(SystemColor.textInactiveText); + lblFechaN.setFont(new Font("Roboto Black", Font.PLAIN, 18)); + contentPane.add(lblFechaN); + + JLabel lblNacionalidad = new JLabel("NACIONALIDAD"); + lblNacionalidad.setBounds(560, 326, 255, 14); + lblNacionalidad.setForeground(SystemColor.textInactiveText); + lblNacionalidad.setFont(new Font("Roboto Black", Font.PLAIN, 18)); + contentPane.add(lblNacionalidad); + + JLabel lblTelefono = new JLabel("TELÉFONO"); + lblTelefono.setBounds(562, 406, 253, 14); + lblTelefono.setForeground(SystemColor.textInactiveText); + lblTelefono.setFont(new Font("Roboto Black", Font.PLAIN, 18)); + contentPane.add(lblTelefono); + + txtTelefono = new JTextField(); + txtTelefono.setFont(new Font("Roboto", Font.PLAIN, 16)); + txtTelefono.setBounds(560, 424, 285, 33); + txtTelefono.setColumns(10); + txtTelefono.setBackground(Color.WHITE); + txtTelefono.setBorder(javax.swing.BorderFactory.createEmptyBorder()); + contentPane.add(txtTelefono); + + JLabel lblTitulo = new JLabel("REGISTRO HUÉSPED"); + lblTitulo.setBounds(606, 55, 234, 42); + lblTitulo.setForeground(new Color(12, 138, 199)); + lblTitulo.setFont(new Font("Roboto Black", Font.PLAIN, 23)); + contentPane.add(lblTitulo); + + JLabel lblNumeroReserva = new JLabel("NÚMERO DE RESERVA"); + lblNumeroReserva.setBounds(560, 474, 253, 14); + lblNumeroReserva.setForeground(SystemColor.textInactiveText); + lblNumeroReserva.setFont(new Font("Roboto Black", Font.PLAIN, 18)); + contentPane.add(lblNumeroReserva); + + txtNreserva = new JTextField(); + txtNreserva.setFont(new Font("Roboto", Font.PLAIN, 16)); + txtNreserva.setBounds(560, 495, 285, 33); + txtNreserva.setColumns(10); + txtNreserva.setBackground(Color.WHITE); + txtNreserva.setBorder(javax.swing.BorderFactory.createEmptyBorder()); + contentPane.add(txtNreserva); + + JSeparator separator_1_2 = new JSeparator(); + separator_1_2.setBounds(560, 170, 289, 2); + separator_1_2.setForeground(new Color(12, 138, 199)); + separator_1_2.setBackground(new Color(12, 138, 199)); + contentPane.add(separator_1_2); + + JSeparator separator_1_2_1 = new JSeparator(); + separator_1_2_1.setBounds(560, 240, 289, 2); + separator_1_2_1.setForeground(new Color(12, 138, 199)); + separator_1_2_1.setBackground(new Color(12, 138, 199)); + contentPane.add(separator_1_2_1); + + JSeparator separator_1_2_2 = new JSeparator(); + separator_1_2_2.setBounds(560, 314, 289, 2); + separator_1_2_2.setForeground(new Color(12, 138, 199)); + separator_1_2_2.setBackground(new Color(12, 138, 199)); + contentPane.add(separator_1_2_2); + + JSeparator separator_1_2_3 = new JSeparator(); + separator_1_2_3.setBounds(560, 386, 289, 2); + separator_1_2_3.setForeground(new Color(12, 138, 199)); + separator_1_2_3.setBackground(new Color(12, 138, 199)); + contentPane.add(separator_1_2_3); + + JSeparator separator_1_2_4 = new JSeparator(); + separator_1_2_4.setBounds(560, 457, 289, 2); + separator_1_2_4.setForeground(new Color(12, 138, 199)); + separator_1_2_4.setBackground(new Color(12, 138, 199)); + contentPane.add(separator_1_2_4); + + JSeparator separator_1_2_5 = new JSeparator(); + separator_1_2_5.setBounds(560, 529, 289, 2); + separator_1_2_5.setForeground(new Color(12, 138, 199)); + separator_1_2_5.setBackground(new Color(12, 138, 199)); + contentPane.add(separator_1_2_5); + + JPanel btnguardar = new JPanel(); + btnguardar.setBounds(723, 560, 122, 35); + btnguardar.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + } + }); + btnguardar.setLayout(null); + btnguardar.setBackground(new Color(12, 138, 199)); + contentPane.add(btnguardar); + btnguardar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + + JLabel labelGuardar = new JLabel("GUARDAR"); + labelGuardar.setHorizontalAlignment(SwingConstants.CENTER); + labelGuardar.setForeground(Color.WHITE); + labelGuardar.setFont(new Font("Roboto", Font.PLAIN, 18)); + labelGuardar.setBounds(0, 0, 122, 35); + btnguardar.add(labelGuardar); + + JPanel panel = new JPanel(); + panel.setBounds(0, 0, 489, 634); + panel.setBackground(new Color(12, 138, 199)); + contentPane.add(panel); + panel.setLayout(null); + + JLabel imagenFondo = new JLabel(""); + imagenFondo.setBounds(0, 121, 479, 502); + panel.add(imagenFondo); + imagenFondo.setIcon(new ImageIcon(RegistroHuesped.class.getResource("/imagenes/registro.png"))); + + JLabel logo = new JLabel(""); + logo.setBounds(194, 39, 104, 107); + panel.add(logo); + logo.setIcon(new ImageIcon(RegistroHuesped.class.getResource("/imagenes/Ha-100px.png"))); + + JPanel btnexit = new JPanel(); + btnexit.setBounds(857, 0, 53, 36); + contentPane.add(btnexit); + btnexit.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + MenuPrincipal principal = new MenuPrincipal(); + principal.setVisible(true); + dispose(); + } + + @Override + public void mouseEntered(MouseEvent e) { + btnexit.setBackground(Color.red); + labelExit.setForeground(Color.white); + } + + @Override + public void mouseExited(MouseEvent e) { + btnexit.setBackground(Color.white); + labelExit.setForeground(Color.black); + } + }); + btnexit.setLayout(null); + btnexit.setBackground(Color.white); + + labelExit = new JLabel("X"); + labelExit.setBounds(0, 0, 53, 36); + btnexit.add(labelExit); + labelExit.setHorizontalAlignment(SwingConstants.CENTER); + labelExit.setForeground(SystemColor.black); + labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); + } + + // Código que permite mover la ventana por la pantalla según la posición de "x" + // y "y" + private void headerMousePressed(java.awt.event.MouseEvent evt) { + xMouse = evt.getX(); + yMouse = evt.getY(); + } + + private void headerMouseDragged(java.awt.event.MouseEvent evt) { + int x = evt.getXOnScreen(); + int y = evt.getYOnScreen(); + this.setLocation(x - xMouse, y - yMouse); + } + +} diff --git a/src/cl/com/alura/hotel/views/ReservasView.java b/src/cl/com/alura/hotel/views/ReservasView.java new file mode 100644 index 0000000..6d5a507 --- /dev/null +++ b/src/cl/com/alura/hotel/views/ReservasView.java @@ -0,0 +1,330 @@ +package cl.com.alura.hotel.views; + +import java.awt.EventQueue; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.EmptyBorder; +import java.awt.SystemColor; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.ImageIcon; +import java.awt.Color; +import javax.swing.JTextField; +import com.toedter.calendar.JDateChooser; +import java.awt.Font; +import javax.swing.JComboBox; +import javax.swing.DefaultComboBoxModel; +import java.text.Format; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.awt.Toolkit; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeEvent; +import javax.swing.JSeparator; +import javax.swing.SwingConstants; +import javax.swing.border.LineBorder; + +@SuppressWarnings("serial") +public class ReservasView extends JFrame { + + private JPanel contentPane; + public static JTextField txtValor; + public static JDateChooser txtFechaEntrada; + public static JDateChooser txtFechaSalida; + public static JComboBox txtFormaPago; + int xMouse, yMouse; + private JLabel labelExit; + private JLabel labelAtras; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + ReservasView frame = new ReservasView(); + frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the frame. + */ + public ReservasView() { + super("Reserva"); + setIconImage(Toolkit.getDefaultToolkit().getImage(ReservasView.class.getResource("/imagenes/aH-40px.png"))); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setBounds(100, 100, 910, 560); + setResizable(false); + contentPane = new JPanel(); + contentPane.setBackground(SystemColor.control); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(null); + setResizable(false); + setLocationRelativeTo(null); + setUndecorated(true); + + JPanel panel = new JPanel(); + panel.setBorder(null); + panel.setBackground(Color.WHITE); + panel.setBounds(0, 0, 910, 560); + contentPane.add(panel); + panel.setLayout(null); + + // Código que crea los elementos de la interfáz gráfica + + JSeparator separator_1_2 = new JSeparator(); + separator_1_2.setForeground(SystemColor.textHighlight); + separator_1_2.setBounds(68, 195, 289, 2); + separator_1_2.setBackground(SystemColor.textHighlight); + panel.add(separator_1_2); + + JSeparator separator_1_3 = new JSeparator(); + separator_1_3.setForeground(SystemColor.textHighlight); + separator_1_3.setBackground(SystemColor.textHighlight); + separator_1_3.setBounds(68, 453, 289, 2); + panel.add(separator_1_3); + + JSeparator separator_1_1 = new JSeparator(); + separator_1_1.setForeground(SystemColor.textHighlight); + separator_1_1.setBounds(68, 281, 289, 11); + separator_1_1.setBackground(SystemColor.textHighlight); + panel.add(separator_1_1); + + JLabel lblCheckIn = new JLabel("FECHA DE CHECK IN"); + lblCheckIn.setForeground(SystemColor.textInactiveText); + lblCheckIn.setBounds(68, 136, 169, 14); + lblCheckIn.setFont(new Font("Roboto Black", Font.PLAIN, 18)); + panel.add(lblCheckIn); + + JLabel lblCheckOut = new JLabel("FECHA DE CHECK OUT"); + lblCheckOut.setForeground(SystemColor.textInactiveText); + lblCheckOut.setBounds(68, 221, 187, 14); + lblCheckOut.setFont(new Font("Roboto Black", Font.PLAIN, 18)); + panel.add(lblCheckOut); + + JLabel lblFormaPago = new JLabel("FORMA DE PAGO"); + lblFormaPago.setForeground(SystemColor.textInactiveText); + lblFormaPago.setBounds(68, 382, 187, 24); + lblFormaPago.setFont(new Font("Roboto Black", Font.PLAIN, 18)); + panel.add(lblFormaPago); + + JLabel lblTitulo = new JLabel("SISTEMA DE RESERVAS"); + lblTitulo.setBounds(109, 60, 219, 42); + lblTitulo.setForeground(new Color(12, 138, 199)); + lblTitulo.setFont(new Font("Roboto", Font.BOLD, 20)); + panel.add(lblTitulo); + + JPanel panel_1 = new JPanel(); + panel_1.setBounds(428, 0, 482, 560); + panel_1.setBackground(new Color(12, 138, 199)); + panel.add(panel_1); + panel_1.setLayout(null); + + JLabel logo = new JLabel(""); + logo.setBounds(197, 68, 104, 107); + panel_1.add(logo); + logo.setIcon(new ImageIcon(ReservasView.class.getResource("/imagenes/Ha-100px.png"))); + + JLabel imagenFondo = new JLabel(""); + imagenFondo.setBounds(0, 140, 500, 409); + panel_1.add(imagenFondo); + imagenFondo.setBackground(Color.WHITE); + imagenFondo.setIcon(new ImageIcon(ReservasView.class.getResource("/imagenes/reservas-img-3.png"))); + + JLabel lblValor = new JLabel("VALOR DE LA RESERVA"); + lblValor.setForeground(SystemColor.textInactiveText); + lblValor.setBounds(72, 303, 196, 14); + lblValor.setFont(new Font("Roboto Black", Font.PLAIN, 18)); + panel.add(lblValor); + + JSeparator separator_1 = new JSeparator(); + separator_1.setForeground(SystemColor.textHighlight); + separator_1.setBounds(68, 362, 289, 2); + separator_1.setBackground(SystemColor.textHighlight); + panel.add(separator_1); + + // Componentes para dejar la interfaz con estilo Material Design + JPanel btnexit = new JPanel(); + btnexit.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + MenuPrincipal principal = new MenuPrincipal(); + principal.setVisible(true); + dispose(); + } + + @Override + public void mouseEntered(MouseEvent e) { + btnexit.setBackground(Color.red); + labelExit.setForeground(Color.white); + } + + @Override + public void mouseExited(MouseEvent e) { + btnexit.setBackground(new Color(12, 138, 199)); + labelExit.setForeground(Color.white); + } + }); + btnexit.setLayout(null); + btnexit.setBackground(new Color(12, 138, 199)); + btnexit.setBounds(429, 0, 53, 36); + panel_1.add(btnexit); + + labelExit = new JLabel("X"); + labelExit.setForeground(Color.WHITE); + labelExit.setBounds(0, 0, 53, 36); + btnexit.add(labelExit); + labelExit.setHorizontalAlignment(SwingConstants.CENTER); + labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); + + JPanel header = new JPanel(); + header.setBounds(0, 0, 910, 36); + header.addMouseMotionListener(new MouseMotionAdapter() { + @Override + public void mouseDragged(MouseEvent e) { + headerMouseDragged(e); + + } + }); + header.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + headerMousePressed(e); + } + }); + header.setLayout(null); + header.setBackground(Color.WHITE); + panel.add(header); + + JPanel btnAtras = new JPanel(); + btnAtras.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + MenuUsuario usuario = new MenuUsuario(); + usuario.setVisible(true); + dispose(); + } + + @Override + public void mouseEntered(MouseEvent e) { + btnAtras.setBackground(new Color(12, 138, 199)); + labelAtras.setForeground(Color.white); + } + + @Override + public void mouseExited(MouseEvent e) { + btnAtras.setBackground(Color.white); + labelAtras.setForeground(Color.black); + } + }); + btnAtras.setLayout(null); + btnAtras.setBackground(Color.WHITE); + btnAtras.setBounds(0, 0, 53, 36); + header.add(btnAtras); + + labelAtras = new JLabel("<"); + labelAtras.setBounds(0, 0, 53, 36); + btnAtras.add(labelAtras); + labelAtras.setHorizontalAlignment(SwingConstants.CENTER); + labelAtras.setFont(new Font("Roboto", Font.PLAIN, 23)); + + JLabel lblSiguiente = new JLabel("SIGUIENTE"); + lblSiguiente.setHorizontalAlignment(SwingConstants.CENTER); + lblSiguiente.setForeground(Color.WHITE); + lblSiguiente.setFont(new Font("Roboto", Font.PLAIN, 18)); + lblSiguiente.setBounds(0, 0, 122, 35); + + // Campos que guardaremos en la base de datos + txtFechaEntrada = new JDateChooser(); + txtFechaEntrada.getCalendarButton().setBackground(SystemColor.textHighlight); + txtFechaEntrada.getCalendarButton() + .setIcon(new ImageIcon(ReservasView.class.getResource("/imagenes/icon-reservas.png"))); + txtFechaEntrada.getCalendarButton().setFont(new Font("Roboto", Font.PLAIN, 12)); + txtFechaEntrada.setBounds(68, 161, 289, 35); + txtFechaEntrada.getCalendarButton().setBounds(268, 0, 21, 33); + txtFechaEntrada.setBackground(Color.WHITE); + txtFechaEntrada.setBorder(new LineBorder(SystemColor.window)); + txtFechaEntrada.setDateFormatString("yyyy-MM-dd"); + txtFechaEntrada.setFont(new Font("Roboto", Font.PLAIN, 18)); + panel.add(txtFechaEntrada); + + txtFechaSalida = new JDateChooser(); + txtFechaSalida.getCalendarButton() + .setIcon(new ImageIcon(ReservasView.class.getResource("/imagenes/icon-reservas.png"))); + txtFechaSalida.getCalendarButton().setFont(new Font("Roboto", Font.PLAIN, 11)); + txtFechaSalida.setBounds(68, 246, 289, 35); + txtFechaSalida.getCalendarButton().setBounds(267, 1, 21, 31); + txtFechaSalida.setBackground(Color.WHITE); + txtFechaSalida.setFont(new Font("Roboto", Font.PLAIN, 18)); + txtFechaSalida.addPropertyChangeListener(new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + // Activa el evento, después del usuario seleccionar las fechas se debe calcular + // el valor de la reserva + } + }); + txtFechaSalida.setDateFormatString("yyyy-MM-dd"); + txtFechaSalida.getCalendarButton().setBackground(SystemColor.textHighlight); + txtFechaSalida.setBorder(new LineBorder(new Color(255, 255, 255), 0)); + panel.add(txtFechaSalida); + + txtValor = new JTextField(); + txtValor.setBackground(SystemColor.text); + txtValor.setHorizontalAlignment(SwingConstants.CENTER); + txtValor.setForeground(Color.BLACK); + txtValor.setBounds(78, 328, 43, 33); + txtValor.setEditable(false); + txtValor.setFont(new Font("Roboto Black", Font.BOLD, 17)); + txtValor.setBorder(javax.swing.BorderFactory.createEmptyBorder()); + panel.add(txtValor); + txtValor.setColumns(10); + + txtFormaPago = new JComboBox(); + txtFormaPago.setBounds(68, 417, 289, 38); + txtFormaPago.setBackground(SystemColor.text); + txtFormaPago.setBorder(new LineBorder(new Color(255, 255, 255), 1, true)); + txtFormaPago.setFont(new Font("Roboto", Font.PLAIN, 16)); + txtFormaPago.setModel(new DefaultComboBoxModel( + new String[] { "Tarjeta de Crédito", "Tarjeta de Débito", "Dinero en efectivo" })); + panel.add(txtFormaPago); + + JPanel btnsiguiente = new JPanel(); + btnsiguiente.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (ReservasView.txtFechaEntrada.getDate() != null && ReservasView.txtFechaSalida.getDate() != null) { + RegistroHuesped registro = new RegistroHuesped(); + registro.setVisible(true); + } else { + JOptionPane.showMessageDialog(null, "Debes llenar todos los campos."); + } + } + }); + btnsiguiente.setLayout(null); + btnsiguiente.setBackground(SystemColor.textHighlight); + btnsiguiente.setBounds(238, 493, 122, 35); + panel.add(btnsiguiente); + btnsiguiente.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); + + } + + // Código que permite mover la ventana por la pantalla según la posición de "x" + // y "y" + private void headerMousePressed(java.awt.event.MouseEvent evt) { + xMouse = evt.getX(); + yMouse = evt.getY(); + } + + private void headerMouseDragged(java.awt.event.MouseEvent evt) { + int x = evt.getXOnScreen(); + int y = evt.getYOnScreen(); + this.setLocation(x - xMouse, y - yMouse); + } +} diff --git a/src/imagenes/Ha-100px.png b/src/imagenes/Ha-100px.png new file mode 100644 index 0000000..2c9548f Binary files /dev/null and b/src/imagenes/Ha-100px.png differ diff --git a/src/imagenes/aH-150px.png b/src/imagenes/aH-150px.png new file mode 100644 index 0000000..3d146ed Binary files /dev/null and b/src/imagenes/aH-150px.png differ diff --git a/src/imagenes/aH-40px.png b/src/imagenes/aH-40px.png new file mode 100644 index 0000000..22c1803 Binary files /dev/null and b/src/imagenes/aH-40px.png differ diff --git a/src/imagenes/busqueda.png b/src/imagenes/busqueda.png new file mode 100644 index 0000000..88e4abc Binary files /dev/null and b/src/imagenes/busqueda.png differ diff --git a/src/imagenes/calendario.png b/src/imagenes/calendario.png new file mode 100644 index 0000000..4bba9eb Binary files /dev/null and b/src/imagenes/calendario.png differ diff --git a/src/imagenes/cancelar.png b/src/imagenes/cancelar.png new file mode 100644 index 0000000..1f2a7de Binary files /dev/null and b/src/imagenes/cancelar.png differ diff --git a/src/imagenes/cerrar-24px.png b/src/imagenes/cerrar-24px.png new file mode 100644 index 0000000..a671f93 Binary files /dev/null and b/src/imagenes/cerrar-24px.png differ diff --git a/src/imagenes/cerrar-sesion 32-px.png b/src/imagenes/cerrar-sesion 32-px.png new file mode 100644 index 0000000..98fd04e Binary files /dev/null and b/src/imagenes/cerrar-sesion 32-px.png differ diff --git a/src/imagenes/deletar.png b/src/imagenes/deletar.png new file mode 100644 index 0000000..33d07c6 Binary files /dev/null and b/src/imagenes/deletar.png differ diff --git a/src/imagenes/disquete.png b/src/imagenes/disquete.png new file mode 100644 index 0000000..1f4020e Binary files /dev/null and b/src/imagenes/disquete.png differ diff --git a/src/imagenes/editar-texto.png b/src/imagenes/editar-texto.png new file mode 100644 index 0000000..1a29b09 Binary files /dev/null and b/src/imagenes/editar-texto.png differ diff --git a/src/imagenes/hotel.png b/src/imagenes/hotel.png new file mode 100644 index 0000000..58c491c Binary files /dev/null and b/src/imagenes/hotel.png differ diff --git a/src/imagenes/icon-buscar.png b/src/imagenes/icon-buscar.png new file mode 100644 index 0000000..27ba579 Binary files /dev/null and b/src/imagenes/icon-buscar.png differ diff --git a/src/imagenes/icon-reservas.png b/src/imagenes/icon-reservas.png new file mode 100644 index 0000000..f84bc65 Binary files /dev/null and b/src/imagenes/icon-reservas.png differ diff --git a/src/imagenes/img-hotel-login-.png b/src/imagenes/img-hotel-login-.png new file mode 100644 index 0000000..220c366 Binary files /dev/null and b/src/imagenes/img-hotel-login-.png differ diff --git a/src/imagenes/lOGO-50PX.png b/src/imagenes/lOGO-50PX.png new file mode 100644 index 0000000..ce956b6 Binary files /dev/null and b/src/imagenes/lOGO-50PX.png differ diff --git a/src/imagenes/login.png b/src/imagenes/login.png new file mode 100644 index 0000000..67f7185 Binary files /dev/null and b/src/imagenes/login.png differ diff --git a/src/imagenes/login2.png b/src/imagenes/login2.png new file mode 100644 index 0000000..b90743e Binary files /dev/null and b/src/imagenes/login2.png differ diff --git a/src/imagenes/lupa-1.png b/src/imagenes/lupa-1.png new file mode 100644 index 0000000..3f17117 Binary files /dev/null and b/src/imagenes/lupa-1.png differ diff --git a/src/imagenes/lupa2.png b/src/imagenes/lupa2.png new file mode 100644 index 0000000..6e38e96 Binary files /dev/null and b/src/imagenes/lupa2.png differ diff --git a/src/imagenes/menu-img.png b/src/imagenes/menu-img.png new file mode 100644 index 0000000..b293152 Binary files /dev/null and b/src/imagenes/menu-img.png differ diff --git a/src/imagenes/papelera-de-reciclaje.png b/src/imagenes/papelera-de-reciclaje.png new file mode 100644 index 0000000..48ff695 Binary files /dev/null and b/src/imagenes/papelera-de-reciclaje.png differ diff --git a/src/imagenes/perfil-del-usuario.png b/src/imagenes/perfil-del-usuario.png new file mode 100644 index 0000000..7b4ba45 Binary files /dev/null and b/src/imagenes/perfil-del-usuario.png differ diff --git a/src/imagenes/persona.png b/src/imagenes/persona.png new file mode 100644 index 0000000..b846811 Binary files /dev/null and b/src/imagenes/persona.png differ diff --git a/src/imagenes/pessoas.png b/src/imagenes/pessoas.png new file mode 100644 index 0000000..eef4375 Binary files /dev/null and b/src/imagenes/pessoas.png differ diff --git a/src/imagenes/registro.png b/src/imagenes/registro.png new file mode 100644 index 0000000..ea5b7c2 Binary files /dev/null and b/src/imagenes/registro.png differ diff --git a/src/imagenes/reservado.png b/src/imagenes/reservado.png new file mode 100644 index 0000000..3c0e9ad Binary files /dev/null and b/src/imagenes/reservado.png differ diff --git a/src/imagenes/reservas-img-3.png b/src/imagenes/reservas-img-3.png new file mode 100644 index 0000000..59e46ad Binary files /dev/null and b/src/imagenes/reservas-img-3.png differ diff --git a/src/imagenes/reservas.png b/src/imagenes/reservas.png new file mode 100644 index 0000000..6327d63 Binary files /dev/null and b/src/imagenes/reservas.png differ diff --git a/src/module-info.java b/src/module-info.java new file mode 100644 index 0000000..77978d0 --- /dev/null +++ b/src/module-info.java @@ -0,0 +1,14 @@ +/** + * + */ +/** + * + */ +module hotel_alura { + exports cl.com.alura.hotel.pruebas; + + requires io.github.cdimascio.dotenv.java; + requires java.sql; + requires java.desktop; + requires jcalendar; +} \ No newline at end of file diff --git a/target/hotel_alura-0.0.1-SNAPSHOT.jar b/target/hotel_alura-0.0.1-SNAPSHOT.jar new file mode 100644 index 0000000..f53a73c Binary files /dev/null and b/target/hotel_alura-0.0.1-SNAPSHOT.jar differ