Merge remote-tracking branch 'origin/main'

This commit is contained in:
David 2024-03-11 07:06:24 -06:00
commit 90bca1959e
19 changed files with 373 additions and 15 deletions

View File

@ -22,6 +22,7 @@
<jdbc-additional-properties>
<property name="com.intellij.clouds.kubernetes.db.host.port" />
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
<property name="com.intellij.clouds.kubernetes.db.resource.type" value="Deployment" />
<property name="com.intellij.clouds.kubernetes.db.container.port" />
</jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir>

View File

@ -10,7 +10,7 @@
<orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$USER_HOME$/Downloads/mysql-connector-j-8.0.31.jar!/" />
<root url="jar://$USER_HOME$/Downloads/mysql-connector-java-8.0.30.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View File

@ -1,4 +1,5 @@
import javax.swing.*;
import java.awt.*;
public class Main {
public static void main(String[] args) {
@ -6,6 +7,11 @@ public class Main {
JFrame frame = new JFrame("Login");
frame.setContentPane(new ventana1().panel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Dimension pantalla = Toolkit.getDefaultToolkit().getScreenSize();
int height = pantalla.height;
int width = pantalla.width;
frame.setSize(width/2, height/2);
frame.setLocationRelativeTo(null);
frame.pack();
frame.setVisible(true);
});

115
TeatroGUI.java Normal file
View File

@ -0,0 +1,115 @@
/*
Interfaz de compra de boletos aún por trabajar
El botón CONTINUAR llevaría a la interfaz de pago con tarjeta :)
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.Map;
public class TeatroGUI extends JFrame {
private JLabel titleLabel;
private JLabel priceLabel;
private JPanel ticketPanel;
private Map<String, Integer> selectedTickets;
private JTextArea ticketListTextArea;
private JButton continuarButton;
private static final double VIP_ZONE = 100.0;
private static final double PREFERENCIAL_ZONE = 80.0;
private static final double STANDAR_ZONE = 60.0;
public TeatroGUI() {
setTitle("Compra de Boletos Ticketmania");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(500, 700);
setLayout(new FlowLayout(FlowLayout.CENTER));
titleLabel = new JLabel("Seleccione el tipo de boleto para las zonas:");
add(titleLabel);
priceLabel = new JLabel("Precios: VIP $" + VIP_ZONE + " | Preferencial $" + PREFERENCIAL_ZONE + " | Estándar $" + STANDAR_ZONE);
add(priceLabel);
selectedTickets = new HashMap<>();
ticketPanel = new JPanel(new GridLayout(3, 2));
addTicketOption("VIP ");
addTicketOption("Preferencial ");
addTicketOption("Estándar ");
add(ticketPanel);
continuarButton = new JButton("Continuar");
ticketListTextArea = new JTextArea(30, 30);
ticketListTextArea.setEditable(false);
add(ticketListTextArea);
add(continuarButton);
setVisible(true);
}
private void addTicketOption(String ticketType) {
JLabel label = new JLabel(ticketType);
ticketPanel.add(label);
JButton plusButton = new JButton("+");
plusButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
selectedTickets.put(ticketType, selectedTickets.getOrDefault(ticketType, 0) + 1);
updateTicketList();
}
});
ticketPanel.add(plusButton);
JButton minusButton = new JButton("-");
minusButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int currentCount = selectedTickets.getOrDefault(ticketType, 0);
if (currentCount > 0) {
selectedTickets.put(ticketType, currentCount - 1);
updateTicketList();
}
}
});
ticketPanel.add(minusButton);
}
private void updateTicketList() {
StringBuilder sb = new StringBuilder();
double totalPrice = 0.0;
for (Map.Entry<String, Integer> entry : selectedTickets.entrySet()) {
String ticketType = entry.getKey();
int quantity = entry.getValue();
double price = 0.0;
switch (ticketType) {
case "VIP ":
price = VIP_ZONE;
break;
case "Preferencial ":
price = PREFERENCIAL_ZONE;
break;
case "Estándar ":
price = STANDAR_ZONE;
break;
}
totalPrice += price * quantity;
sb.append(ticketType).append(": ").append(quantity).append(" boletos\n");
}
sb.append("Total: $").append(totalPrice).append("\n");
//JTextArea ticketListTextArea = (JTextArea) getContentPane().getComponent(4);
ticketListTextArea.setText(sb.toString());
}
public static void main(String[] args) {
new TeatroGUI();
}
}

View File

@ -9,6 +9,20 @@
<jdbc-additional-properties>
<property name="com.intellij.clouds.kubernetes.db.host.port" />
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
<property name="com.intellij.clouds.kubernetes.db.resource.type" value="Deployment" />
<property name="com.intellij.clouds.kubernetes.db.container.port" />
</jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
<data-source source="LOCAL" name="@localhost" uuid="5c6ea976-6ab8-4264-9c10-a818b02ab966">
<driver-ref>mysql.8</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
<jdbc-additional-properties>
<property name="com.intellij.clouds.kubernetes.db.host.port" />
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
<property name="com.intellij.clouds.kubernetes.db.resource.type" value="Deployment" />
<property name="com.intellij.clouds.kubernetes.db.container.port" />
</jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir>

View File

@ -10,7 +10,7 @@
<orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$USER_HOME$/Downloads/mysql-connector-j-8.0.31.jar!/" />
<root url="jar://$USER_HOME$/Downloads/mysql-connector-java-8.0.30.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,16 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="registerV">
<grid id="27dc6" binding="panelPrincipal" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="panelPrincipal" layout-manager="GridLayoutManager" row-count="8" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<properties>
<background color="-4527617"/>
</properties>
<border type="none"/>
<children>
<component id="4161a" class="javax.swing.JTextField" binding="nombreText">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
@ -18,7 +20,7 @@
</component>
<component id="a97e6" class="javax.swing.JLabel" binding="nombreLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nombre"/>
@ -26,7 +28,7 @@
</component>
<component id="4e45c" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Correo"/>
@ -34,7 +36,7 @@
</component>
<component id="44135" class="javax.swing.JTextField" binding="emailText">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
@ -42,7 +44,7 @@
</component>
<component id="47862" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<grid row="5" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Contraseña"/>
@ -50,7 +52,7 @@
</component>
<component id="33198" class="javax.swing.JPasswordField" binding="contrasena1">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="6" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
@ -58,12 +60,32 @@
</component>
<component id="7fb07" class="javax.swing.JButton" binding="registrarseButton" default-binding="true">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="7" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-12631553"/>
<foreground color="-1544"/>
<text value="Registrarse"/>
</properties>
</component>
<component id="dafef" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="JetBrains Mono" size="22" style="1"/>
<text value="Registrarse"/>
</properties>
</component>
<component id="f2e3a" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<icon value="Máscaras-de-Teatro (1).jpg"/>
<text value=""/>
</properties>
</component>
</children>
</grid>
</form>

View File

@ -6,6 +6,8 @@
<xy x="20" y="20" width="811" height="568"/>
</constraints>
<properties>
<alignmentX value="0.5"/>
<background color="-4527617"/>
<enabled value="false"/>
<opaque value="false"/>
<visible value="true"/>
@ -27,7 +29,7 @@
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font size="16" style="1"/>
<font name="Arial Black" size="16" style="1"/>
<text value="Inicio de sesion"/>
</properties>
</component>
@ -36,6 +38,8 @@
<grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-12631553"/>
<foreground color="-1544"/>
<text value="REGISTRARSE"/>
</properties>
</component>
@ -57,7 +61,7 @@
<horizontalAlignment value="0"/>
<horizontalTextPosition value="0"/>
<opaque value="false"/>
<text value="TicketMania"/>
<text value="Ticketmania"/>
</properties>
</component>
<component id="b0f83" class="javax.swing.JLabel" binding="usuarioLabel">
@ -65,7 +69,8 @@
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Usuario"/>
<font name="Arial Black"/>
<text value="Usuario:"/>
</properties>
</component>
<component id="a9848" class="javax.swing.JLabel">
@ -90,7 +95,8 @@
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Contraseña"/>
<font name="Arial Black"/>
<text value="Contraseña:"/>
</properties>
</component>
<component id="57715" class="javax.swing.JPasswordField" binding="contrasenal">
@ -106,6 +112,8 @@
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-12631553"/>
<foreground color="-1544"/>
<text value="INICIAR SESION"/>
</properties>
</component>

View File

@ -1,4 +1,5 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -8,6 +9,7 @@ public class ventana1 {
private JButton iniciarBoton;
private JButton registerBoton;
private JPasswordField contrasenal;
private JPanel panelPrincipal;
private JLabel usuarioLabel;
private JLabel contrasenaLabel;
private JLabel inicioText;
@ -26,6 +28,16 @@ public class ventana1 {
if (user != null) {
JOptionPane.showMessageDialog(null, "Inicio de sesión exitoso");
// Aquí puedes realizar otras acciones después de iniciar sesión correctamente
// Obtener el JFrame actual y cerrarlo
JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(panel);
frame.dispose();
// Mostrar el panel de inicio de sesión
JFrame principalFrame = new JFrame("Principal");
principalFrame.setContentPane(new ventana2().panelV2);
principalFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
principalFrame.pack();
principalFrame.setVisible(true);
} else {
JOptionPane.showMessageDialog(null, "Usuario o contraseña incorrectos");
}
@ -43,6 +55,11 @@ public class ventana1 {
JFrame registerFrame = new JFrame("Registro de Usuario");
registerFrame.setContentPane(new registerV().getPanel());
registerFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Dimension pantalla = Toolkit.getDefaultToolkit().getScreenSize();
int height = pantalla.height;
int width = pantalla.width;
frame.setSize(width/2, height/2);
frame.setLocationRelativeTo(null);
registerFrame.pack();
registerFrame.setVisible(true);
}

156
ventana2.form Normal file
View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ventana2">
<grid id="27dc6" binding="panelV2" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="856" height="592"/>
</constraints>
<properties>
<background color="-4527617"/>
<foreground color="-3349030"/>
<preferredSize width="1800" height="1080"/>
<visible value="true"/>
</properties>
<border type="none"/>
<children>
<component id="c960e" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<icon value="Máscaras-de-Teatro (1).jpg"/>
<text value=""/>
</properties>
</component>
<grid id="21365" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="4" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c64dc" class="javax.swing.JButton" binding="button1" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<background color="-16777216"/>
<icon value="divinacomedia (1).jpg"/>
<text value=""/>
</properties>
</component>
<component id="7ceba" class="javax.swing.JButton" binding="button2" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<icon value="romeo-y-julieta (1).jpg"/>
<text value=""/>
</properties>
</component>
<component id="41766" class="javax.swing.JButton" binding="button3" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<icon value="espera (1).jpg"/>
<text value=""/>
</properties>
</component>
<component id="9bb7f" class="javax.swing.JButton" binding="button4" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<icon value="fantasOpera (1).png"/>
<text value=""/>
</properties>
</component>
<component id="8d4f" class="javax.swing.JButton" binding="button5" default-binding="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<icon value="nostalgia (1).jpg"/>
<text value=""/>
</properties>
</component>
<component id="62051" class="javax.swing.JButton" binding="button6" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<icon value="quijote (1).jpg"/>
<text value=""/>
</properties>
</component>
<component id="ffae7" class="javax.swing.JScrollBar" binding="scrollBar1" default-binding="true">
<constraints>
<grid row="0" column="2" row-span="3" col-span="1" vsize-policy="6" hsize-policy="0" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<orientation value="1"/>
</properties>
</component>
</children>
</grid>
<component id="dc6aa" class="javax.swing.JButton" binding="comprarBoletosButton" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Comprar Boletos"/>
</properties>
</component>
<component id="fce23" class="javax.swing.JButton" binding="carteleraButton" default-binding="true">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Cartelera"/>
</properties>
</component>
<component id="f9c98" class="javax.swing.JButton" binding="cerrarSesiónButton" default-binding="true">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Cerrar sesión"/>
</properties>
</component>
<component id="6b1b7" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Arial Black" size="24" style="2"/>
<foreground color="-16777216"/>
<text value="Ticketmania - Teatro del Estado"/>
</properties>
</component>
<component id="1c50d" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Arial Black" size="14" style="2"/>
<foreground color="-16777216"/>
<text value="Cartelera"/>
</properties>
</component>
<component id="76bd0" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Arial Black" size="14" style="2"/>
<foreground color="-16777216"/>
<horizontalAlignment value="0"/>
<horizontalTextPosition value="0"/>
<text value="Menus"/>
</properties>
</component>
</children>
</grid>
</form>

19
ventana2.java Normal file
View File

@ -0,0 +1,19 @@
import javax.swing.*;
public class ventana2 {
JPanel panelV2;
private JButton comprarBoletosButton;
private JButton carteleraButton;
private JButton cerrarSesiónButton;
private JButton button1;
private JButton button2;
private JButton button3;
private JButton button4;
private JButton button5;
private JButton button6;
private JScrollBar scrollBar1;
public ventana2 (){
}
}