This commit is contained in:
alberto
2026-04-04 23:21:12 +02:00
parent b53872ac84
commit b4562407c0

View File

@@ -1,5 +1,6 @@
package interfazGrafica;
import servicios.GestorParqueo;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JLabel;
@@ -8,41 +9,55 @@ import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Font;
import java.awt.Color;
import javax.swing.JOptionPane;
public class PanelHome extends JPanel {
public PanelHome() {
public PanelHome(VentanaPrincipal ventana) {
setLayout(new BorderLayout(10, 10));
JLabel titulo = new JLabel("Bienvenido", JLabel.CENTER);
titulo.setFont(new Font("Arial", Font.BOLD, 24));
titulo.setFont(new Font("Arial", Font.BOLD, 42));
Font btnFont = new Font("Arial", Font.BOLD, 18);
JButton btnIngreso = new JButton("Registrar Ingreso");
JButton btnSalida = new JButton("Registrar Salida");
JButton btnRegistro = new JButton("Registrar ingreso");
JButton btnSalida = new JButton("Registrar salida");
JButton btnEspDisp = new JButton("Espacios disponibles");
JButton btnReportes = new JButton("Reportes del dia");
JButton btnSalir = new JButton("Salir");
btnIngreso.setFont(btnFont);
btnSalir.setBackground(Color.RED);
btnSalir.setForeground(Color.WHITE);
btnRegistro.setFont(btnFont);
btnSalida.setFont(btnFont);
btnEspDisp.setFont(btnFont);
btnReportes.setFont(btnFont);
btnSalir.setFont(btnFont);
JPanel gridPanel = new JPanel(new GridLayout(2,2,5,5));
gridPanel.setPreferredSize(new Dimension(320,320));
gridPanel.add(btnIngreso);
JPanel gridPanel = new JPanel(new GridLayout(2, 2, 5, 5));
gridPanel.setPreferredSize(new Dimension(320, 320));
gridPanel.add(btnRegistro);
gridPanel.add(btnSalida);
gridPanel.add(btnEspDisp);
gridPanel.add(btnReportes);
btnRegistro.addActionListener(e -> ventana.mostrarPanel(new PanelRegistro(ventana)));
btnReportes.addActionListener(e -> ventana.mostrarPanel(new PanelReportes(ventana)));//lambda
btnSalida.addActionListener();
btnEspDisp.addActionListener(e -> JOptionPane.showMessageDialog(null, "Espacios disponibles: " + ventana.getGestor().espaciosDisponibles()));
btnSalir.addActionListener(e
-> System.exit(0));
JPanel southPanel = new JPanel();
southPanel.add(btnSalir);
add(titulo, BorderLayout.NORTH);
add(gridPanel, BorderLayout.CENTER);
add(southPanel, BorderLayout.SOUTH);
}