From e58ddbca6bb5ecfbcbe4ed300d7076c9dd8e632d Mon Sep 17 00:00:00 2001 From: David Date: Sun, 10 Mar 2024 20:31:19 -0600 Subject: [PATCH] Ventana Asientos Avances --- SeleccionarAsientoV.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/SeleccionarAsientoV.java b/SeleccionarAsientoV.java index bae819f..d86a830 100644 --- a/SeleccionarAsientoV.java +++ b/SeleccionarAsientoV.java @@ -5,7 +5,7 @@ public class SeleccionarAsientoV extends JFrame { private JPanel pSuperior = new JPanel(new FlowLayout(FlowLayout.LEFT)); private JButton bRegresar = new JButton("Regresar."); - int noAsientosSeleccionados = 0; + private int noAsientosSeleccionados = 0; private JLabel lSeleccionar = new JLabel("Asientos seleccionados: " + noAsientosSeleccionados); private JPanel pInferior = new JPanel(new FlowLayout(FlowLayout.CENTER)); @@ -15,7 +15,10 @@ public class SeleccionarAsientoV extends JFrame { private JPanel pSala = new JPanel(new GridBagLayout()); - JToggleButton [][]asientos; + private JToggleButton [][]bAsientos; + + private Asiento [][] asientos; + public SeleccionarAsientoV() throws HeadlessException { super("Seleccionar Asiento"); @@ -41,7 +44,7 @@ public class SeleccionarAsientoV extends JFrame { GridBagConstraints con = new GridBagConstraints(); - asientos = new JToggleButton[parX][parY]; + bAsientos = new JToggleButton[parX][parY]; String zona = ""; @@ -52,14 +55,17 @@ public class SeleccionarAsientoV extends JFrame { if( ( (j >= 2) && (j <= 7) ) && ( (i >= 2) && (i <= 6) ) ){ tfAux.setBackground(Color.PINK); zona = "A"; + tfAux.setText("200$"); } if( ((i == 1) && (j > 0) && (j < 9)) || ((j == 1) && (i > 0)) || ((j == 8) && (i > 0)) ){ tfAux.setBackground(Color.ORANGE); zona = "B"; + tfAux.setText("130$"); } if( (i == 0) || (j == 0) || (j == 9)){ tfAux.setBackground(Color.YELLOW); zona = "C"; + tfAux.setText("65$"); } tfAux.setSize(100,100); //tfAux.addKeyListener(new GestiónTecladoEscribirCaracter(this,i,j)); @@ -68,9 +74,9 @@ public class SeleccionarAsientoV extends JFrame { con.gridy = i; con.gridheight = 1; con.gridwidth = 1; - System.out.println(i+" "+j+ " "+asientos.length); - asientos[i][j] = tfAux; - pSala.add(asientos[i][j],con); + System.out.println(i+" "+j+ " "+bAsientos.length); + bAsientos[i][j] = tfAux; + pSala.add(bAsientos[i][j],con); } } @@ -98,7 +104,7 @@ public class SeleccionarAsientoV extends JFrame { break; } - if(asientos[x][y].isSelected()){ + if(bAsientos[x][y].isSelected()){ noAsientosSeleccionados ++; total += precio; }else{