From ae33689c77c9f04c1d626f772abdf668fb7f994f Mon Sep 17 00:00:00 2001 From: xFractu Date: Mon, 18 Mar 2024 13:53:50 -0600 Subject: [PATCH] avance 11 --- .../src/Vista/BotonConImagen.java | 38 ++++- .../src/Vista/VentanaConciertos.form | 142 +++--------------- .../src/Vista/VentanaConciertos.java | 114 +++----------- .../src/Vista/panelAsientos.java | 14 +- 4 files changed, 83 insertions(+), 225 deletions(-) diff --git a/ProyectoConciertoApp/src/Vista/BotonConImagen.java b/ProyectoConciertoApp/src/Vista/BotonConImagen.java index 3c0c823..18bb6af 100644 --- a/ProyectoConciertoApp/src/Vista/BotonConImagen.java +++ b/ProyectoConciertoApp/src/Vista/BotonConImagen.java @@ -7,12 +7,14 @@ import java.awt.event.ActionListener; class BotonConImagen extends JButton { int cambio = 0; - int precio = 150; + int precio; private String id; // Campo id privado private boolean isAmarillo = false; // Estado para indicar si está utilizando el color amarillo + int precio2; - public BotonConImagen(String id) { + public BotonConImagen(String id, String zona) { + precio2 = precioPorZona(zona); this.id = id; ImageIcon icono = new ImageIcon("C:/Users/mario/OneDrive/Documentos/NetBeansProjects/Imagene/src/asdasdasdasd.png"); setIcon(icono); // Establece la imagen en el botón @@ -43,7 +45,36 @@ class BotonConImagen extends JButton { } }); } - + + + public int precioPorZona(String zona){ + + if(zona == "asientoA1" || zona == "asientoA2" || zona == "asientoA3"){ + return 3500; + }else{ + if(zona == "asientoB1" || zona == "asientoB2" || zona == "asientoB3" || zona == "asientoB4"){ + return 3000; + }else{ + if(zona == "asientoC1" || zona == "asientoC2" || zona == "asientoC3" || zona == "asientoC4"){ + return 2500; + }else{ + if(zona == "asientoD1" || zona == "asientoD2" || zona == "asientoD3" || zona == "asientoD4"){ + return 1200; + }else{ + if(zona == "asientoE1" || zona == "asientoE2" || zona == "asientoE3" || zona == "asientoE4" || zona == "asientoE5"){ + return 9000; + }else{ + if(zona == "asientoF1" || zona == "asientoF2" || zona == "asientoF3" || zona == "asientoF4" || zona == "asientoF5"){ + return 600; + } + } + } + } + } + return 1; + } + } + // Métodos getter y setter para el campo id public String getId() { return id; @@ -54,6 +85,7 @@ class BotonConImagen extends JButton { } public int getPrecio() { + precio = precio2; return precio; } diff --git a/ProyectoConciertoApp/src/Vista/VentanaConciertos.form b/ProyectoConciertoApp/src/Vista/VentanaConciertos.form index 2939ed0..dadf155 100644 --- a/ProyectoConciertoApp/src/Vista/VentanaConciertos.form +++ b/ProyectoConciertoApp/src/Vista/VentanaConciertos.form @@ -23,7 +23,7 @@ - + @@ -48,11 +48,12 @@ - - - + + + + + - @@ -62,7 +63,6 @@ - @@ -79,6 +79,19 @@ + + + + + + + + + + + + + @@ -122,20 +135,7 @@ - - - - - - - - - - - - - - + @@ -1567,7 +1567,7 @@ - + @@ -1594,98 +1594,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1700,11 +1608,11 @@ - - + + - - + + diff --git a/ProyectoConciertoApp/src/Vista/VentanaConciertos.java b/ProyectoConciertoApp/src/Vista/VentanaConciertos.java index d05d0bc..793c647 100644 --- a/ProyectoConciertoApp/src/Vista/VentanaConciertos.java +++ b/ProyectoConciertoApp/src/Vista/VentanaConciertos.java @@ -97,11 +97,11 @@ public class VentanaConciertos extends javax.swing.JFrame { Principal = new javax.swing.JPanel(); barraSuperior = new javax.swing.JPanel(); + jButton1 = new javax.swing.JButton(); imgConcierto = new javax.swing.JLabel(); banda = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); fondoportada = new javax.swing.JLabel(); - jButton1 = new javax.swing.JButton(); panelSeleccion = new javax.swing.JPanel(); panelMapaAsientos = new javax.swing.JPanel(); panelMapaSala = new javax.swing.JPanel(); @@ -160,11 +160,6 @@ public class VentanaConciertos extends javax.swing.JFrame { jLabel1 = new javax.swing.JLabel(); panelColumnas = new javax.swing.JPanel(); LabelNums = new javax.swing.JLabel(); - jPanel1 = new javax.swing.JPanel(); - jScrollPane1 = new javax.swing.JScrollPane(); - asientosSelecc = new javax.swing.JPanel(); - jPanel4 = new javax.swing.JPanel(); - jPanel5 = new javax.swing.JPanel(); panelFilas = new javax.swing.JPanel(); LabelA = new javax.swing.JLabel(); LabelB = new javax.swing.JLabel(); @@ -179,6 +174,14 @@ public class VentanaConciertos extends javax.swing.JFrame { barraSuperior.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); + jButton1.setText("volver"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + barraSuperior.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(730, 30, 130, 60)); + imgConcierto.setText("ImgConcierto"); barraSuperior.add(imgConcierto, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, 190, 110)); @@ -189,15 +192,7 @@ public class VentanaConciertos extends javax.swing.JFrame { jLabel12.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N jLabel12.setForeground(new java.awt.Color(255, 255, 255)); barraSuperior.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 70, 300, 30)); - barraSuperior.add(fondoportada, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1260, 130)); - - jButton1.setText("volver"); - jButton1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButton1ActionPerformed(evt); - } - }); - barraSuperior.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(1032, 30, 130, 60)); + barraSuperior.add(fondoportada, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 970, 130)); panelSeleccion.setBackground(new java.awt.Color(255, 255, 255)); @@ -1230,7 +1225,7 @@ public class VentanaConciertos extends javax.swing.JFrame { .addGroup(panelColumnasLayout.createSequentialGroup() .addContainerGap() .addComponent(LabelNums, javax.swing.GroupLayout.PREFERRED_SIZE, 748, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(21, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); panelColumnasLayout.setVerticalGroup( panelColumnasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -1259,69 +1254,6 @@ public class VentanaConciertos extends javax.swing.JFrame { .addContainerGap()) ); - jPanel1.setBackground(new java.awt.Color(204, 204, 204)); - - jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - - javax.swing.GroupLayout asientosSeleccLayout = new javax.swing.GroupLayout(asientosSelecc); - asientosSelecc.setLayout(asientosSeleccLayout); - asientosSeleccLayout.setHorizontalGroup( - asientosSeleccLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 321, Short.MAX_VALUE) - ); - asientosSeleccLayout.setVerticalGroup( - asientosSeleccLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 551, Short.MAX_VALUE) - ); - - jScrollPane1.setViewportView(asientosSelecc); - - javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE) - ); - jPanel4Layout.setVerticalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE) - ); - - javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); - jPanel5.setLayout(jPanel5Layout); - jPanel5Layout.setHorizontalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE) - ); - jPanel5Layout.setVerticalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 75, Short.MAX_VALUE) - ); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jScrollPane1)) - .addContainerGap()) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 553, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addContainerGap()) - ); - panelFilas.setBackground(new java.awt.Color(255, 255, 255)); LabelA.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N @@ -1350,11 +1282,11 @@ public class VentanaConciertos extends javax.swing.JFrame { .addContainerGap() .addGroup(panelFilasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(LabelA, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(LabelB, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE) - .addComponent(LabelC, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE) + .addComponent(LabelB, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(LabelC, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(LabelD, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE) - .addComponent(LabelE, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE) - .addComponent(LabelF, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)) + .addComponent(LabelE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(LabelF, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); panelFilasLayout.setVerticalGroup( @@ -1384,10 +1316,10 @@ public class VentanaConciertos extends javax.swing.JFrame { .addComponent(panelFilas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(panelSeleccion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - .addComponent(barraSuperior, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addGap(135, 135, 135)) + .addGroup(PrincipalLayout.createSequentialGroup() + .addComponent(barraSuperior, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) ); PrincipalLayout.setVerticalGroup( PrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -1396,7 +1328,6 @@ public class VentanaConciertos extends javax.swing.JFrame { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(PrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panelSeleccion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(PrincipalLayout.createSequentialGroup() .addComponent(panelFilas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()))) @@ -1406,7 +1337,7 @@ public class VentanaConciertos extends javax.swing.JFrame { getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(Principal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(Principal, javax.swing.GroupLayout.PREFERRED_SIZE, 870, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -2138,7 +2069,6 @@ public class VentanaConciertos extends javax.swing.JFrame { private javax.swing.JLabel LabelF; private javax.swing.JLabel LabelNums; private javax.swing.JPanel Principal; - private javax.swing.JPanel asientosSelecc; private javax.swing.JLabel banda; private javax.swing.JPanel barraSuperior; private javax.swing.JLabel fondoportada; @@ -2171,12 +2101,8 @@ public class VentanaConciertos extends javax.swing.JFrame { private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; - private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel5; - private javax.swing.JScrollPane jScrollPane1; private javax.swing.JPanel panelColumnas; private javax.swing.JPanel panelFilas; private javax.swing.JPanel panelMapaAsientos; diff --git a/ProyectoConciertoApp/src/Vista/panelAsientos.java b/ProyectoConciertoApp/src/Vista/panelAsientos.java index 0b3994b..3cf4276 100644 --- a/ProyectoConciertoApp/src/Vista/panelAsientos.java +++ b/ProyectoConciertoApp/src/Vista/panelAsientos.java @@ -63,7 +63,7 @@ public class panelAsientos extends JPanel { panelCentral.add(sala); precioLabel = new JLabel("Precio total: $0"); - precioLabel.setBounds(0, 70, 100, 30); + precioLabel.setBounds(0, 70, 180, 30); panelCentral.add(precioLabel); int posX = 30; @@ -113,7 +113,7 @@ public class panelAsientos extends JPanel { String id = rs.getString("id"); String estado = rs.getString("estado"); - BotonConImagen boton = new BotonConImagen(id); + BotonConImagen boton = new BotonConImagen(id, zona); boton.setBounds(posX, posY, 70, 70); panelCentral.add(boton); @@ -143,7 +143,7 @@ public class panelAsientos extends JPanel { int numeroColumna = columna + 1; String idAsiento = String.valueOf(letraFila) + numeroColumna; - BotonConImagen boton = new BotonConImagen(idAsiento); + BotonConImagen boton = new BotonConImagen(idAsiento,zona); boton.setBounds(posX, posY, 70, 70); panelCentral.add(boton); @@ -204,14 +204,6 @@ public class panelAsientos extends JPanel { add(panelCentral, BorderLayout.CENTER); - // Crear panelSeleccionA y establecer su color - JPanel panelSeleccionA = new JPanel(); - panelSeleccionA.setBackground(Color.RED); - - // Agregar panelSeleccionA al este de panelAsientos - add(panelSeleccionA, BorderLayout.EAST); - - } } \ No newline at end of file