diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index 6d3d9d1..7b5a2a2 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -22,6 +22,7 @@ + $ProjectFileDir$ diff --git a/.idea/mezontleTeam.iml b/.idea/mezontleTeam.iml index b9f5507..8d579e1 100644 --- a/.idea/mezontleTeam.iml +++ b/.idea/mezontleTeam.iml @@ -10,7 +10,7 @@ - + diff --git a/Main.java b/Main.java index b5bf9c6..c1220d3 100644 --- a/Main.java +++ b/Main.java @@ -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); }); diff --git a/TeatroGUI.java b/TeatroGUI.java new file mode 100644 index 0000000..d90a6c5 --- /dev/null +++ b/TeatroGUI.java @@ -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 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 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(); + } +} \ No newline at end of file diff --git a/out/production/mezontleTeam/.idea/dataSources.xml b/out/production/mezontleTeam/.idea/dataSources.xml index 4657635..7b5a2a2 100644 --- a/out/production/mezontleTeam/.idea/dataSources.xml +++ b/out/production/mezontleTeam/.idea/dataSources.xml @@ -9,6 +9,20 @@ + + + + $ProjectFileDir$ + + + mysql.8 + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://localhost:3306 + + + + $ProjectFileDir$ diff --git a/out/production/mezontleTeam/.idea/mezontleTeam.iml b/out/production/mezontleTeam/.idea/mezontleTeam.iml index b9f5507..8d579e1 100644 --- a/out/production/mezontleTeam/.idea/mezontleTeam.iml +++ b/out/production/mezontleTeam/.idea/mezontleTeam.iml @@ -10,7 +10,7 @@ - + diff --git a/out/production/mezontleTeam/Main.class b/out/production/mezontleTeam/Main.class index 1bc14d2..5fa310e 100644 Binary files a/out/production/mezontleTeam/Main.class and b/out/production/mezontleTeam/Main.class differ diff --git a/out/production/mezontleTeam/TeatroGUI$1.class b/out/production/mezontleTeam/TeatroGUI$1.class new file mode 100644 index 0000000..f34c371 Binary files /dev/null and b/out/production/mezontleTeam/TeatroGUI$1.class differ diff --git a/out/production/mezontleTeam/TeatroGUI$2.class b/out/production/mezontleTeam/TeatroGUI$2.class new file mode 100644 index 0000000..2c1e7cb Binary files /dev/null and b/out/production/mezontleTeam/TeatroGUI$2.class differ diff --git a/out/production/mezontleTeam/TeatroGUI.class b/out/production/mezontleTeam/TeatroGUI.class new file mode 100644 index 0000000..7344edd Binary files /dev/null and b/out/production/mezontleTeam/TeatroGUI.class differ diff --git a/out/production/mezontleTeam/registerV.class b/out/production/mezontleTeam/registerV.class index 38b43f7..077d4e1 100644 Binary files a/out/production/mezontleTeam/registerV.class and b/out/production/mezontleTeam/registerV.class differ diff --git a/out/production/mezontleTeam/ventana1$1.class b/out/production/mezontleTeam/ventana1$1.class index f9ba452..9871314 100644 Binary files a/out/production/mezontleTeam/ventana1$1.class and b/out/production/mezontleTeam/ventana1$1.class differ diff --git a/out/production/mezontleTeam/ventana1$2.class b/out/production/mezontleTeam/ventana1$2.class index f273178..8d88370 100644 Binary files a/out/production/mezontleTeam/ventana1$2.class and b/out/production/mezontleTeam/ventana1$2.class differ diff --git a/out/production/mezontleTeam/ventana1.class b/out/production/mezontleTeam/ventana1.class index d4d5065..9cbf33f 100644 Binary files a/out/production/mezontleTeam/ventana1.class and b/out/production/mezontleTeam/ventana1.class differ diff --git a/registerV.form b/registerV.form index f306805..81d4178 100644 --- a/registerV.form +++ b/registerV.form @@ -1,16 +1,18 @@
- + - + + + - + @@ -18,7 +20,7 @@ - + @@ -26,7 +28,7 @@ - + @@ -34,7 +36,7 @@ - + @@ -42,7 +44,7 @@ - + @@ -50,7 +52,7 @@ - + @@ -58,12 +60,32 @@ - + + + + + + + + + + + + + + + + + + + + + diff --git a/ventana1.form b/ventana1.form index 9535b3c..9de00dc 100644 --- a/ventana1.form +++ b/ventana1.form @@ -6,6 +6,8 @@ + + @@ -27,7 +29,7 @@ - + @@ -36,6 +38,8 @@ + + @@ -57,7 +61,7 @@ - + @@ -65,7 +69,8 @@ - + + @@ -90,7 +95,8 @@ - + + @@ -106,6 +112,8 @@ + + diff --git a/ventana1.java b/ventana1.java index 8bfe28d..7a0c52a 100644 --- a/ventana1.java +++ b/ventana1.java @@ -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); } diff --git a/ventana2.form b/ventana2.form new file mode 100644 index 0000000..dba8edc --- /dev/null +++ b/ventana2.form @@ -0,0 +1,156 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ventana2.java b/ventana2.java new file mode 100644 index 0000000..53aeb4c --- /dev/null +++ b/ventana2.java @@ -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 (){ + + } +}