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; package interfazGrafica;
import servicios.GestorParqueo;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JLabel; import javax.swing.JLabel;
@@ -8,41 +9,55 @@ import java.awt.Dimension;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.Font; import java.awt.Font;
import java.awt.Color; import java.awt.Color;
import javax.swing.JOptionPane;
public class PanelHome extends JPanel { public class PanelHome extends JPanel {
public PanelHome() { public PanelHome(VentanaPrincipal ventana) {
setLayout(new BorderLayout(10, 10)); setLayout(new BorderLayout(10, 10));
JLabel titulo = new JLabel("Bienvenido", JLabel.CENTER); 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); Font btnFont = new Font("Arial", Font.BOLD, 18);
JButton btnIngreso = new JButton("Registrar Ingreso"); JButton btnRegistro = new JButton("Registrar ingreso");
JButton btnSalida = new JButton("Registrar Salida"); JButton btnSalida = new JButton("Registrar salida");
JButton btnEspDisp = new JButton("Espacios disponibles"); JButton btnEspDisp = new JButton("Espacios disponibles");
JButton btnReportes = new JButton("Reportes del dia"); JButton btnReportes = new JButton("Reportes del dia");
JButton btnSalir = new JButton("Salir"); JButton btnSalir = new JButton("Salir");
btnIngreso.setFont(btnFont); btnSalir.setBackground(Color.RED);
btnSalir.setForeground(Color.WHITE);
btnRegistro.setFont(btnFont);
btnSalida.setFont(btnFont); btnSalida.setFont(btnFont);
btnEspDisp.setFont(btnFont); btnEspDisp.setFont(btnFont);
btnReportes.setFont(btnFont); btnReportes.setFont(btnFont);
btnSalir.setFont(btnFont); btnSalir.setFont(btnFont);
JPanel gridPanel = new JPanel(new GridLayout(2,2,5,5)); JPanel gridPanel = new JPanel(new GridLayout(2, 2, 5, 5));
gridPanel.setPreferredSize(new Dimension(320,320)); gridPanel.setPreferredSize(new Dimension(320, 320));
gridPanel.add(btnIngreso); gridPanel.add(btnRegistro);
gridPanel.add(btnSalida); gridPanel.add(btnSalida);
gridPanel.add(btnEspDisp); gridPanel.add(btnEspDisp);
gridPanel.add(btnReportes); 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(); JPanel southPanel = new JPanel();
southPanel.add(btnSalir); southPanel.add(btnSalir);
add(titulo, BorderLayout.NORTH); add(titulo, BorderLayout.NORTH);
add(gridPanel, BorderLayout.CENTER); add(gridPanel, BorderLayout.CENTER);
add(southPanel, BorderLayout.SOUTH); add(southPanel, BorderLayout.SOUTH);
} }