Generación de reportes, registro de eventos y ajustes finales a la GUI.

This commit is contained in:
Víctor Manuel Monge Morales 2025-03-12 21:10:32 -06:00
parent 7cc2cc206d
commit e454b86eed
13 changed files with 869 additions and 48 deletions

View File

@ -5,6 +5,13 @@
<artifactId>ProyectoVentaBoletos</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<repositories>
<repository>
<id>unknown-jars-temp-repo</id>
<name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
<url>file:${project.basedir}/lib</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>20</maven.compiler.source>
@ -27,5 +34,15 @@
<artifactId>itextpdf</artifactId>
<version>5.5.13.3</version>
</dependency>
<dependency>
<groupId>com.toedter</groupId>
<artifactId>jcalendar</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>AbsoluteLayout</artifactId>
<version>SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -23,7 +23,7 @@ import model.ModeloSQL;
import model.Venta;
public class GeneradorComprobante {
private static final String RUTA_COMPROBANTES = "C:\\Users\\vmonge\\Desktop\\";
private static final String RUTA_COMPROBANTES = "C:\\Users\\USER\\Desktop\\";
// Fuentes para el documento
private static final Font TITULO_FONT = FontFactory.getFont(FontFactory.HELVETICA_BOLD, 16);

View File

@ -1,6 +1,7 @@
package controller;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
@ -12,10 +13,12 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import model.Evento;
import model.ModeloSQL;
import view.Menu;
import view.MenuSala;
import view.RegistrarEvento;
public class MenuController extends WindowAdapter implements ActionListener, ItemListener {
private Menu menu;
@ -48,6 +51,27 @@ public class MenuController extends WindowAdapter implements ActionListener, Ite
menu.mensaje("Debe seleccionar un evento.");
}
}
if(o.equals(menu.jButtonRegistrarEvento)){
menu.dialog = new JDialog((Frame) null, "Registrar evento", true);
menu.dialog.setSize(400, 200);
menu.dialog.setLocationRelativeTo(null);
menu.dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
System.out.println("MenuController.dialog.windowClosed(): cerrado.");
obtenerEventosDefaultComboBoxMoldel();
}
@Override
public void windowClosing(WindowEvent e) {
System.out.println("MenuController.dialog.windowClosed(): cerrado.");
obtenerEventosDefaultComboBoxMoldel();
}
});
RegistrarEvento registrarEvento = new RegistrarEvento();
menu.dialog.add(registrarEvento);
menu.dialog.setVisible(true);
}
}
public void itemStateChanged(ItemEvent e) {
@ -67,6 +91,7 @@ public class MenuController extends WindowAdapter implements ActionListener, Ite
// Obtener ResultSet de ModeloSQL y añádir eventos al ComboBoxModel del ComboBox de eventos
public void obtenerEventosDefaultComboBoxMoldel(){
ResultSet rs = modeloSQL.obtenerEventos();
menu.defaultComboBoxModel.removeAllElements();
menu.defaultComboBoxModel.addElement("Seleccione un evento");
try {
while ( rs.next() ){

View File

@ -1,5 +1,6 @@
package controller;
import com.toedter.calendar.JDateChooser;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
@ -19,11 +20,17 @@ import model.Evento;
import view.MenuSala;
import model.ModeloSQL;
import model.Venta;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class MenuSalaController implements ActionListener, ItemListener{
public class MenuSalaController implements ActionListener, ItemListener, PropertyChangeListener {
private int idEvento;
private MenuSala menuSala;
private ModeloSQL modeloSQL = new ModeloSQL();
private ReporteVentas reporteVentas;
private ArrayList<JToggleButton> arrayListAsientosSeleccionados;
@ -41,6 +48,7 @@ public class MenuSalaController implements ActionListener, ItemListener{
this.idEvento = menuSala.getIdEvento();
obtenerAsientos(idEvento);// Obtener información del evento seleccionado desde la BD y añadir botones
arrayListAsientosSeleccionados = new ArrayList<>();
this.reporteVentas = new ReporteVentas(modeloSQL);
}
public void obtenerAsientos(int idEvento){
@ -140,6 +148,19 @@ public class MenuSalaController implements ActionListener, ItemListener{
}
}
if(o.equals(menuSala.jButtonGenerarReporte)){
if(menuSala.fechaInicioReporte.getDate() == null || menuSala.fechaFinalReporte.getDate() == null){
menuSala.mensaje("Debe introducir tanto la fecha de inicio como la fecha final para generar un reporte.");
} else {
String fechaReporteInicio = convertirFechaInicioParaMySQL(menuSala.fechaInicioReporte.getDate());
String fechaReporteFinal = convertirFechaFinalParaMySQL(menuSala.fechaFinalReporte.getDate());
System.out.println("controller.MenuSalaController.actionPerformed(): fechaReporteInicio: " + fechaReporteInicio + " fechaReporteFinal: " + fechaReporteFinal);
reporteVentas.reporte(idEvento, fechaReporteInicio, fechaReporteFinal);
menuSala.fechaInicioReporte.setDate(null);
menuSala.fechaFinalReporte.setDate(null);
menuSala.mensaje("Reporte generado.");
}
}
}
@Override
@ -223,7 +244,7 @@ public class MenuSalaController implements ActionListener, ItemListener{
menuSala.jButtonRealizarVenta.setEnabled(false);
menuSala.jPanelBotones.setBackground(Color.decode("#F6F6F6"));
menuSala.jButtonSeleccionarAsientosVenta.setBackground(Color.WHITE);
menuSala.mensaje("Comprobante generado.");
}
public void generarComprobante(int idVenta){
@ -235,7 +256,62 @@ public class MenuSalaController implements ActionListener, ItemListener{
ArrayList<Boleto> boletos = modeloSQL.obtenerBoletosVenta(idVenta);
GeneradorComprobante.generarComprobantePDF(venta, evento, boletos);
}
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
// Verifica que el evento sea sobre la fecha
if ("date".equals(evt.getPropertyName())) {
// Para saber quién disparó el evento guardamos el objeto
JDateChooser source = (JDateChooser) evt.getSource();
// Si el evento vino de la fecha de inicio
if (source == menuSala.fechaInicioReporte) {
Date fecha = menuSala.fechaInicioReporte.getDate();
//System.out.println("controller.MenuSalaController.propertyChange(): fecha de inicio seleccionada " + fecha);
} else if (source == menuSala.fechaFinalReporte) { // Si el evento vino de la fecha final
Date fecha = menuSala.fechaFinalReporte.getDate();
//System.out.println("controller.MenuSalaController.propertyChange(): fecha de inicio seleccionada " + fecha);
}
}
}
public String convertirFechaInicioParaMySQL(Date fecha) {
// Crear una instancia de Calendar y establecer la fecha
Calendar calendar = Calendar.getInstance();
calendar.setTime(fecha);
// Resetear la hora a 00:00:00.000
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
// Obtener la fecha con hora 00:00:00
Date fechaConHoraReseteada = calendar.getTime();
// El formato DATETIME de MySQL es: YYYY-MM-DD HH:MM:SS
SimpleDateFormat formatoMySQL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatoMySQL.format(fechaConHoraReseteada);
}
public String convertirFechaFinalParaMySQL(Date fecha) {
// Crear una instancia de Calendar y establecer la fecha
Calendar calendar = Calendar.getInstance();
calendar.setTime(fecha);
// Establecer la hora a 23:59:59.999 (final del día)
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
// Obtener la fecha con hora 23:59:59
Date fechaFinDia = calendar.getTime();
// El formato DATETIME de MySQL es: YYYY-MM-DD HH:MM:SS
SimpleDateFormat formatoMySQL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatoMySQL.format(fechaFinDia);
}
}

View File

@ -0,0 +1,48 @@
package controller;
import view.RegistrarEvento;
import model.ModeloSQL;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.time.LocalDate;
import java.text.SimpleDateFormat;
import java.util.Date;
public class RegistrarEventoController implements ActionListener{
private ModeloSQL modeloSQL;
RegistrarEvento registrarEvento;
public RegistrarEventoController(RegistrarEvento re){
this.registrarEvento = re;
modeloSQL = new ModeloSQL();
}
@Override
public void actionPerformed(ActionEvent e) {
Object o = e.getSource();
if(o.equals(registrarEvento.jButtonRegistrarEvento)){
// Validar campos
String nombre = registrarEvento.jTextFieldNombre.getText().trim();
if(nombre.isEmpty()){
registrarEvento.mensaje("Ingrese un nombre valido.");
return;
}
if(registrarEvento.fecha.getDate() == null){
registrarEvento.mensaje("Ingrese una fecha.");
return;
}
Date fechaEvento = registrarEvento.fecha.getDate();
SimpleDateFormat formatoMySQL = new SimpleDateFormat("yyyy-MM-dd");
String fechaFormateada = formatoMySQL.format(fechaEvento);
modeloSQL.insertarEvento(nombre, fechaFormateada);
registrarEvento.jTextFieldNombre.setText("");
registrarEvento.fecha.setDate(null);
registrarEvento.mensaje("Evento registrado.");
}
}
}

View File

@ -0,0 +1,199 @@
package controller;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import model.Evento;
import model.Venta;
import model.ModeloSQL;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.FontFactory;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
public class ReporteVentas {
ModeloSQL modeloSQL;
private static final String RUTA = "C:\\Users\\USER\\Desktop\\";
public ReporteVentas(ModeloSQL modeloSQL) {
this.modeloSQL = modeloSQL;
}
// Método para formatear fechas String al formato dd/mm/yyyy
private String formatearFechaString(String fechaOriginal) {
try {
SimpleDateFormat formatoOriginal = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat formatoNuevo = new SimpleDateFormat("dd/MM/yyyy");
Date fecha = formatoOriginal.parse(fechaOriginal);
return formatoNuevo.format(fecha);
} catch (ParseException e) {
// Si hay error, devolver la fecha original
return fechaOriginal;
}
}
// Método para formatear objetos Date al formato dd/mm/yyyy
private String formatearFecha(Date fecha) {
if (fecha == null) {
return "Fecha no disponible";
}
SimpleDateFormat formatoNuevo = new SimpleDateFormat("dd/MM/yyyy");
return formatoNuevo.format(fecha);
}
// Método para formatear objetos LocalDateTime al formato dd/mm/yyyy hh:mm:ss
private String formatearFechaHora(LocalDateTime fechaHora) {
if (fechaHora == null) {
return "Fecha no disponible";
}
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss");
return fechaHora.format(formatter);
}
// Generar el reporte de ventas
public void reporte(int idEvento, String fechaInicio, String fechaFinal) {
Document documento = new Document();
try {
// Crear el archivo PDF
String rutaArchivo = RUTA + "Reporte_ventas_evento_" + idEvento + ".pdf";
PdfWriter.getInstance(documento, new FileOutputStream(rutaArchivo));
documento.open();
// Definir fuentes
Font fuenteTitulo = FontFactory.getFont(FontFactory.HELVETICA_BOLD, 16);
Font fuenteSubtitulo = FontFactory.getFont(FontFactory.HELVETICA_BOLD, 12);
Font fuenteNormal = FontFactory.getFont(FontFactory.HELVETICA, 10);
// Obtener la información del evento
Evento evento = modeloSQL.obteneEvento(idEvento);
if (evento == null) {
Paragraph parrafoError = new Paragraph("No se encontró el evento con id: " + idEvento, fuenteSubtitulo);
documento.add(parrafoError);
documento.close();
return;
}
// Agregar título del reporte
Paragraph titulo = new Paragraph("Reporte de ventas", fuenteTitulo);
titulo.setAlignment(Element.ALIGN_CENTER);
documento.add(titulo);
documento.add(new Paragraph("\n"));
// Información del evento con fecha formateada (getFecha() retorna Date)
String fechaEventoFormateada = formatearFecha(evento.getFecha());
Paragraph infoEvento = new Paragraph("Evento: " + evento.getNombre() + ", Fecha: " + fechaEventoFormateada, fuenteSubtitulo);
documento.add(infoEvento);
// Período del reporte con fechas formateadas
String fechaInicioFormateada = formatearFechaString(fechaInicio);
String fechaFinalFormateada = formatearFechaString(fechaFinal);
Paragraph periodo = new Paragraph("Reporte de ventas de " + fechaInicioFormateada + " a " + fechaFinalFormateada, fuenteSubtitulo);
documento.add(periodo);
documento.add(new Paragraph("\n"));
// Obtener las ventas para el evento en el rango de fechas (usando fechas originales)
ArrayList<Venta> ventasList = modeloSQL.obtenerVentas(idEvento, fechaInicio, fechaFinal);
for (Venta venta : ventasList) {
// Información de la venta
Paragraph ventaInfo = new Paragraph("Venta ID: " + venta.getIdVenta(), fuenteSubtitulo);
documento.add(ventaInfo);
// Formatear fecha de venta (getFechaVenta() retorna LocalDateTime)
String fechaVentaFormateada = formatearFechaHora(venta.getFechaVenta());
documento.add(new Paragraph("Fecha de venta: " + fechaVentaFormateada, fuenteNormal));
documento.add(new Paragraph("Boletos vendidos: " + venta.getTotalBoletos(), fuenteNormal));
documento.add(new Paragraph("Monto total: " + venta.getTotalMonto(), fuenteNormal));
// Agregar tabla de boletos
documento.add(new Paragraph("\nBoletos:", fuenteSubtitulo));
documento.add(new Paragraph("\n"));
agregarTablaBoletosVenta(documento, venta.getIdVenta());
documento.add(new Paragraph("\n"));
}
System.out.println("Reporte PDF generado correctamente: " + rutaArchivo);
} catch (DocumentException | IOException e) {
System.out.println("Error al generar el PDF: " + e.getMessage());
e.printStackTrace();
} catch (SQLException e) {
System.out.println("Error en la consulta SQL: " + e.getMessage());
e.printStackTrace();
} finally {
if (documento.isOpen()) {
documento.close();
}
}
}
// Función para agregar una tabla con los boletos asociados a una venta
private void agregarTablaBoletosVenta(Document documento, int idVenta) throws DocumentException {
PdfPTable tabla = new PdfPTable(4);
tabla.setWidthPercentage(100);
// Establecer anchos relativos de las columnas
try {
tabla.setWidths(new float[]{1, 1, 1, 1});
} catch (DocumentException e) {
e.printStackTrace();
}
// Agregar encabezados de la tabla
PdfPCell celdaId = new PdfPCell(new Phrase("ID Boleto"));
PdfPCell celdaPrecio = new PdfPCell(new Phrase("Precio"));
PdfPCell celdaFila = new PdfPCell(new Phrase("Fila"));
PdfPCell celdaNumero = new PdfPCell(new Phrase("Número"));
// Centrar encabezados
celdaId.setHorizontalAlignment(Element.ALIGN_CENTER);
celdaPrecio.setHorizontalAlignment(Element.ALIGN_CENTER);
celdaFila.setHorizontalAlignment(Element.ALIGN_CENTER);
celdaNumero.setHorizontalAlignment(Element.ALIGN_CENTER);
tabla.addCell(celdaId);
tabla.addCell(celdaPrecio);
tabla.addCell(celdaFila);
tabla.addCell(celdaNumero);
ResultSet rs = modeloSQL.consultarBoletosVenta(idVenta);
try {
while (rs.next()) {
int idBoleto = rs.getInt("idBoleto");
double precio = rs.getDouble("precio");
String fila = rs.getString("fila");
int numero = rs.getInt("numero");
tabla.addCell(String.valueOf(idBoleto));
tabla.addCell(String.valueOf(precio));
tabla.addCell(fila);
tabla.addCell(String.valueOf(numero));
}
} catch (SQLException e) {
try {
documento.add(new Paragraph("Error al obtener información de boletos: " + e.getMessage()));
} catch (DocumentException ex) {
ex.printStackTrace();
}
e.printStackTrace();
}
documento.add(tabla);
}
}

View File

@ -2,6 +2,7 @@ package model;
import controller.ConexionSingleton;
import java.sql.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.logging.Level;
@ -13,6 +14,20 @@ public class ModeloSQL {
public ModeloSQL(){
con = ConexionSingleton.getInstance();
}
public void insertarEvento(String nombre, String fecha) {
String sql = "INSERT INTO eventos (nombre, fecha) VALUES (?, ?)";
try (PreparedStatement stmt = con.prepareStatement(sql)) {
stmt.setString(1, nombre);
stmt.setString(2, fecha);
int rowsInserted = stmt.executeUpdate();
if (rowsInserted > 0) {
System.out.println("model.ModeloSQL.insertarEvento(): El evento fue insertado exitosamente.");
}
} catch (SQLException e) {
System.out.println("model.ModeloSQL.insertarEvento(): Error al insertar el evento " + e.getMessage());
}
}
// Eventos
public ResultSet obtenerEventos(){
@ -206,4 +221,48 @@ public class ModeloSQL {
System.out.println("[!] model.ModeloSQL.obtenerVenta(): no hay ninguna venta asociado a esa id.");
return null;
}
// Función para obtener las ventas de un evento en un rango de fechas
public ArrayList<Venta> obtenerVentas(int idEvento, String fechaInicio, String fechaFinal) throws SQLException {
String sqlVentas = "SELECT * FROM ventas WHERE idEvento = ? AND fechaVenta BETWEEN ? AND ?";
ArrayList<Venta> ventasList = new ArrayList<>();
try (PreparedStatement pst = con.prepareStatement(sqlVentas)) {
pst.setInt(1, idEvento);
pst.setString(2, fechaInicio);
pst.setString(3, fechaFinal);
try (ResultSet rsVentas = pst.executeQuery()) {
while (rsVentas.next()) {
Venta venta = new Venta();
venta.setIdVenta(rsVentas.getInt("idVenta"));
venta.setIdEvento(rsVentas.getInt("idEvento"));
Timestamp ts = rsVentas.getTimestamp("fechaVenta");
if (ts != null) {
venta.setFechaVenta(ts.toLocalDateTime());
}
venta.setTotalBoletos(rsVentas.getInt("totalBoletos"));
venta.setTotalMonto(rsVentas.getDouble("totalMonto"));
ventasList.add(venta);
}
}
}
return ventasList;
}
public ResultSet consultarBoletosVenta(int idVenta) {
ResultSet rs = null;
try {
String sql = "SELECT b.idBoleto, b.precio, a.fila, a.numero " +
"FROM boletos b " +
"JOIN asientos a ON b.idAsiento = a.idAsiento " +
"WHERE b.idVenta = ?";
PreparedStatement pst = con.prepareStatement(sql);
pst.setInt(1, idVenta);
rs = pst.executeQuery();
} catch (SQLException ex) {
System.out.println("model.ModeloSQL.consultarBoletosVenta(): error " + ex);
ex.printStackTrace();
}
return rs;
}
}

View File

@ -37,20 +37,23 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanelMenuSala" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanelMenuSala" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jButtonRegistrarEvento" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="224" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBoxEventos" min="-2" pref="170" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButtonVisualizar" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="349" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jComboBoxEventos" min="-2" pref="170" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButtonVisualizar" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@ -61,6 +64,7 @@
<Component id="jComboBoxEventos" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonVisualizar" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" max="32767" attributes="0"/>
<Component id="jButtonRegistrarEvento" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanelMenuSala" max="32767" attributes="0"/>
@ -95,6 +99,11 @@
</AuxValues>
</Component>
<Container class="javax.swing.JPanel" name="jPanelMenuSala">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection component="jButtonVisualizar" name="border" type="property"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
@ -102,15 +111,23 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="1168" max="32767" attributes="0"/>
<EmptySpace min="0" pref="1162" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="255" max="32767" attributes="0"/>
<EmptySpace min="0" pref="249" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="javax.swing.JButton" name="jButtonRegistrarEvento">
<Properties>
<Property name="text" type="java.lang.String" value="Registrar evento"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
</SubComponents>
</Form>

View File

@ -3,10 +3,11 @@ package view;
import java.awt.BorderLayout;
import controller.MenuController;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
public class Menu extends javax.swing.JFrame {
public JDialog dialog;
public DefaultComboBoxModel<String> defaultComboBoxModel;
public Menu() {
@ -20,6 +21,7 @@ public class Menu extends javax.swing.JFrame {
this.jButtonVisualizar.addActionListener(menuController);
this.jComboBoxEventos.addItemListener(menuController);
addWindowListener(menuController);
this.jButtonRegistrarEvento.addActionListener(menuController);
}
public void mensaje(String mensaje){
@ -34,6 +36,7 @@ public class Menu extends javax.swing.JFrame {
jComboBoxEventos = new javax.swing.JComboBox<>();
jButtonVisualizar = new javax.swing.JButton();
jPanelMenuSala = new javax.swing.JPanel();
jButtonRegistrarEvento = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Aplicación de venta de boletos");
@ -49,33 +52,39 @@ public class Menu extends javax.swing.JFrame {
jButtonVisualizar.setText("Visualizar");
jPanelMenuSala.setBorder(jButtonVisualizar.getBorder());
javax.swing.GroupLayout jPanelMenuSalaLayout = new javax.swing.GroupLayout(jPanelMenuSala);
jPanelMenuSala.setLayout(jPanelMenuSalaLayout);
jPanelMenuSalaLayout.setHorizontalGroup(
jPanelMenuSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1168, Short.MAX_VALUE)
.addGap(0, 1162, Short.MAX_VALUE)
);
jPanelMenuSalaLayout.setVerticalGroup(
jPanelMenuSalaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 255, Short.MAX_VALUE)
.addGap(0, 249, Short.MAX_VALUE)
);
jButtonRegistrarEvento.setText("Registrar evento");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanelMenuSala, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanelMenuSala, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jButtonRegistrarEvento)
.addGap(224, 224, 224)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBoxEventos, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonVisualizar)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addGap(349, 349, 349)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBoxEventos, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonVisualizar)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -84,7 +93,8 @@ public class Menu extends javax.swing.JFrame {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBoxEventos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonVisualizar)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonRegistrarEvento))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanelMenuSala, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
@ -95,6 +105,7 @@ public class Menu extends javax.swing.JFrame {
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.JButton jButtonRegistrarEvento;
public javax.swing.JButton jButtonVisualizar;
public javax.swing.JComboBox<String> jComboBoxEventos;
private javax.swing.JLabel jLabel1;

View File

@ -51,7 +51,7 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="448" max="32767" attributes="0"/>
<EmptySpace min="0" pref="436" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
@ -62,6 +62,9 @@
<Color blue="0" green="0" red="0" type="rgb"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
@ -73,20 +76,45 @@
<Component id="jButtonSeleccionarAsientosVenta" alignment="0" max="32767" attributes="0"/>
<Component id="jButtonRealizarVenta" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace pref="444" max="32767" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanelFechaReporte" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="64" max="32767" attributes="0"/>
<Component id="jButtonGenerarReporte" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButtonSeleccionarAsientosVenta" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButtonRealizarVenta" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="12" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButtonSeleccionarAsientosVenta" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButtonRealizarVenta" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="24" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jPanelFechaReporte" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jButtonGenerarReporte" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jPanel1" max="32767" attributes="0"/>
</Group>
<EmptySpace min="6" pref="6" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
@ -116,6 +144,47 @@
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Container class="javax.swing.JPanel" name="jPanelFechaReporte">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="66" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="javax.swing.JButton" name="jButtonGenerarReporte">
<Properties>
<Property name="text" type="java.lang.String" value="Generar reporte"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="638" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Container>
</SubComponents>

View File

@ -3,24 +3,38 @@ package view;
import controller.MenuSalaController;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import model.Boleto;
import com.toedter.calendar.JDateChooser;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import javax.swing.JLabel;
public class MenuSala extends javax.swing.JPanel {
private int idEvento;
private String nombre;
public JDateChooser fechaInicioReporte;
public JDateChooser fechaFinalReporte;
private JLabel labelFechaInicio;
private JLabel labelFechaFinal;
public MenuSala(int idEvento, String nombre) {
this.idEvento = idEvento;
this.nombre = nombre;
initComponents();
iniciarPanelFechaReporte();
MenuSalaController menuSalaController = new MenuSalaController(this);
jButtonSeleccionarAsientosVenta.addActionListener(menuSalaController);
jButtonRealizarVenta.addActionListener(menuSalaController);
jButtonGenerarReporte.addActionListener(menuSalaController);
fechaInicioReporte.addPropertyChangeListener(menuSalaController);
fechaFinalReporte.addPropertyChangeListener(menuSalaController);
}
public int getIdEvento() {
@ -41,6 +55,19 @@ public class MenuSala extends javax.swing.JPanel {
return opcion;
}
public void iniciarPanelFechaReporte(){
jPanelFechaReporte.setLayout(new GridLayout(2,2));
fechaInicioReporte = new JDateChooser();
fechaFinalReporte = new JDateChooser();
labelFechaInicio = new JLabel("Fecha inicio: ");
labelFechaFinal= new JLabel("Fecha final: ");
jPanelFechaReporte.add(labelFechaInicio);
jPanelFechaReporte.add(fechaInicioReporte);
jPanelFechaReporte.add(labelFechaFinal);
jPanelFechaReporte.add(fechaFinalReporte);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
@ -50,6 +77,9 @@ public class MenuSala extends javax.swing.JPanel {
jLabel1 = new javax.swing.JLabel();
jButtonSeleccionarAsientosVenta = new javax.swing.JButton();
jButtonRealizarVenta = new javax.swing.JButton();
jPanelFechaReporte = new javax.swing.JPanel();
jButtonGenerarReporte = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
javax.swing.GroupLayout jPanelBotonesLayout = new javax.swing.GroupLayout(jPanelBotones);
jPanelBotones.setLayout(jPanelBotonesLayout);
@ -59,7 +89,7 @@ public class MenuSala extends javax.swing.JPanel {
);
jPanelBotonesLayout.setVerticalGroup(
jPanelBotonesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 448, Short.MAX_VALUE)
.addGap(0, 436, Short.MAX_VALUE)
);
jPanel2.setForeground(new java.awt.Color(0, 0, 0));
@ -71,6 +101,30 @@ public class MenuSala extends javax.swing.JPanel {
jButtonRealizarVenta.setText("Realizar venta");
jButtonRealizarVenta.setEnabled(false);
javax.swing.GroupLayout jPanelFechaReporteLayout = new javax.swing.GroupLayout(jPanelFechaReporte);
jPanelFechaReporte.setLayout(jPanelFechaReporteLayout);
jPanelFechaReporteLayout.setHorizontalGroup(
jPanelFechaReporteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanelFechaReporteLayout.setVerticalGroup(
jPanelFechaReporteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 66, Short.MAX_VALUE)
);
jButtonGenerarReporte.setText("Generar reporte");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 638, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
@ -81,18 +135,36 @@ public class MenuSala extends javax.swing.JPanel {
.addComponent(jLabel1)
.addComponent(jButtonSeleccionarAsientosVenta, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonRealizarVenta, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(444, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanelFechaReporte, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGap(0, 64, Short.MAX_VALUE)
.addComponent(jButtonGenerarReporte)))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonSeleccionarAsientosVenta)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonRealizarVenta)
.addContainerGap(12, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonSeleccionarAsientosVenta)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButtonRealizarVenta)
.addContainerGap(24, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jPanelFechaReporte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButtonGenerarReporte))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(6, 6, 6))))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@ -118,10 +190,13 @@ public class MenuSala extends javax.swing.JPanel {
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.JButton jButtonGenerarReporte;
public javax.swing.JButton jButtonRealizarVenta;
public javax.swing.JButton jButtonSeleccionarAsientosVenta;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel1;
public javax.swing.JPanel jPanel2;
public javax.swing.JPanel jPanelBotones;
public javax.swing.JPanel jPanelFechaReporte;
// End of variables declaration//GEN-END:variables
}

View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextFieldNombre" min="-2" pref="179" max="-2" attributes="0"/>
</Group>
<Component id="jPanelFecha" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jButtonRegistrarEvento" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="76" max="32767" attributes="0"/>
</Group>
<Component id="jPanel1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jTextFieldNombre" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButtonRegistrarEvento" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanelFecha" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Nombre:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextFieldNombre">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Container class="javax.swing.JPanel" name="jPanelFecha">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="232" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="javax.swing.JButton" name="jButtonRegistrarEvento">
<Properties>
<Property name="text" type="java.lang.String" value="Registrar"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="94" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,112 @@
package view;
import com.toedter.calendar.JDateChooser;
import java.awt.FlowLayout;
import javax.swing.JApplet;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import controller.RegistrarEventoController;
import java.awt.BorderLayout;
public class RegistrarEvento extends javax.swing.JPanel {
private RegistrarEventoController registrarEventoController;
public JDateChooser fecha;
public RegistrarEvento() {
initComponents();
jPanelFecha.setLayout(new FlowLayout());
JLabel labelFecha = new JLabel("Fecha: ");
fecha = new JDateChooser();
jPanelFecha.add(labelFecha);
jPanelFecha.add(fecha);
registrarEventoController = new RegistrarEventoController(this);
jButtonRegistrarEvento.addActionListener(registrarEventoController);
}
public void mensaje(String mensaje){
JOptionPane.showMessageDialog(this, mensaje);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jTextFieldNombre = new javax.swing.JTextField();
jPanelFecha = new javax.swing.JPanel();
jButtonRegistrarEvento = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel1.setText("Nombre:");
javax.swing.GroupLayout jPanelFechaLayout = new javax.swing.GroupLayout(jPanelFecha);
jPanelFecha.setLayout(jPanelFechaLayout);
jPanelFechaLayout.setHorizontalGroup(
jPanelFechaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 232, Short.MAX_VALUE)
);
jPanelFechaLayout.setVerticalGroup(
jPanelFechaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jButtonRegistrarEvento.setText("Registrar");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 94, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextFieldNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jPanelFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jButtonRegistrarEvento)
.addGap(0, 76, Short.MAX_VALUE))
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextFieldNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)
.addComponent(jButtonRegistrarEvento))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanelFecha, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.JButton jButtonRegistrarEvento;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanelFecha;
public javax.swing.JTextField jTextFieldNombre;
// End of variables declaration//GEN-END:variables
}