Ventana Asientos Avances

This commit is contained in:
David 2024-03-10 20:31:19 -06:00
parent 2e26e90c9a
commit e58ddbca6b
1 changed files with 13 additions and 7 deletions

View File

@ -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{