package tutorialJava.examenes.examen20250404;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import java.awt.GridBagConstraints;
import java.awt.Font;
import java.awt.Insets;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.DefaultComboBoxModel;

public class GestionBiblioteca extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	private JTextField jtfFiltroTituloLibro;
	private JTextField jtfFiltroAutorLibro;
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					GestionBiblioteca frame = new GestionBiblioteca();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public GestionBiblioteca() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

		setContentPane(contentPane);
		GridBagLayout gbl_contentPane = new GridBagLayout();
		gbl_contentPane.columnWidths = new int[]{0, 0, 0};
		gbl_contentPane.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
		gbl_contentPane.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
		gbl_contentPane.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		contentPane.setLayout(gbl_contentPane);
		
		JLabel lblNewLabel = new JLabel("Gestión de préstamos de biblioteca");
		lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 14));
		GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
		gbc_lblNewLabel.gridwidth = 2;
		gbc_lblNewLabel.insets = new Insets(10, 0, 10, 0);
		gbc_lblNewLabel.gridx = 0;
		gbc_lblNewLabel.gridy = 0;
		contentPane.add(lblNewLabel, gbc_lblNewLabel);
		
		JLabel lblNewLabel_1 = new JLabel("Categoría literaria:");
		GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
		gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_1.anchor = GridBagConstraints.EAST;
		gbc_lblNewLabel_1.gridx = 0;
		gbc_lblNewLabel_1.gridy = 1;
		contentPane.add(lblNewLabel_1, gbc_lblNewLabel_1);
		
		JComboBox jcbCategoria = new JComboBox();
		jcbCategoria.setModel(new DefaultComboBoxModel(new String[] {"Novela"}));
		GridBagConstraints gbc_jcbCategoria = new GridBagConstraints();
		gbc_jcbCategoria.insets = new Insets(0, 0, 5, 0);
		gbc_jcbCategoria.fill = GridBagConstraints.HORIZONTAL;
		gbc_jcbCategoria.gridx = 1;
		gbc_jcbCategoria.gridy = 1;
		contentPane.add(jcbCategoria, gbc_jcbCategoria);
		
		JLabel lblNewLabel_2 = new JLabel("Filtro de título de libro:");
		GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints();
		gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST;
		gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_2.gridx = 0;
		gbc_lblNewLabel_2.gridy = 2;
		contentPane.add(lblNewLabel_2, gbc_lblNewLabel_2);
		
		jtfFiltroTituloLibro = new JTextField();
		jtfFiltroTituloLibro.setText("Cien");
		GridBagConstraints gbc_jtfFiltroTituloLibro = new GridBagConstraints();
		gbc_jtfFiltroTituloLibro.insets = new Insets(0, 0, 5, 0);
		gbc_jtfFiltroTituloLibro.fill = GridBagConstraints.HORIZONTAL;
		gbc_jtfFiltroTituloLibro.gridx = 1;
		gbc_jtfFiltroTituloLibro.gridy = 2;
		contentPane.add(jtfFiltroTituloLibro, gbc_jtfFiltroTituloLibro);
		jtfFiltroTituloLibro.setColumns(10);
		
		JLabel lblNewLabel_3 = new JLabel("Filtro de autor de libro:");
		GridBagConstraints gbc_lblNewLabel_3 = new GridBagConstraints();
		gbc_lblNewLabel_3.anchor = GridBagConstraints.EAST;
		gbc_lblNewLabel_3.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_3.gridx = 0;
		gbc_lblNewLabel_3.gridy = 3;
		contentPane.add(lblNewLabel_3, gbc_lblNewLabel_3);
		
		jtfFiltroAutorLibro = new JTextField();
		jtfFiltroAutorLibro.setText("García");
		GridBagConstraints gbc_jtfFiltroAutorLibro = new GridBagConstraints();
		gbc_jtfFiltroAutorLibro.insets = new Insets(0, 0, 5, 0);
		gbc_jtfFiltroAutorLibro.fill = GridBagConstraints.HORIZONTAL;
		gbc_jtfFiltroAutorLibro.gridx = 1;
		gbc_jtfFiltroAutorLibro.gridy = 3;
		contentPane.add(jtfFiltroAutorLibro, gbc_jtfFiltroAutorLibro);
		jtfFiltroAutorLibro.setColumns(10);
		
		JButton btnFiltrarLibros = new JButton("Filtrar libros");
		GridBagConstraints gbc_btnFiltrarLibros = new GridBagConstraints();
		gbc_btnFiltrarLibros.insets = new Insets(0, 0, 5, 0);
		gbc_btnFiltrarLibros.gridx = 1;
		gbc_btnFiltrarLibros.gridy = 4;
		contentPane.add(btnFiltrarLibros, gbc_btnFiltrarLibros);
		
		JLabel lblNewLabel_4 = new JLabel("Libros filtrados:");
		GridBagConstraints gbc_lblNewLabel_4 = new GridBagConstraints();
		gbc_lblNewLabel_4.anchor = GridBagConstraints.EAST;
		gbc_lblNewLabel_4.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_4.gridx = 0;
		gbc_lblNewLabel_4.gridy = 5;
		contentPane.add(lblNewLabel_4, gbc_lblNewLabel_4);
		
		JComboBox jcbLibrosFiltrados = new JComboBox();
		jcbLibrosFiltrados.setModel(new DefaultComboBoxModel(new String[] {"Cien años de soledad - Gabriel García Márquez"}));
		GridBagConstraints gbc_jcbLibrosFiltrados = new GridBagConstraints();
		gbc_jcbLibrosFiltrados.insets = new Insets(0, 0, 5, 0);
		gbc_jcbLibrosFiltrados.fill = GridBagConstraints.HORIZONTAL;
		gbc_jcbLibrosFiltrados.gridx = 1;
		gbc_jcbLibrosFiltrados.gridy = 5;
		contentPane.add(jcbLibrosFiltrados, gbc_jcbLibrosFiltrados);
		
		JLabel lblNewLabel_5 = new JLabel("Datos del préstamo del libro");
		lblNewLabel_5.setFont(new Font("Tahoma", Font.BOLD, 14));
		GridBagConstraints gbc_lblNewLabel_5 = new GridBagConstraints();
		gbc_lblNewLabel_5.gridwidth = 2;
		gbc_lblNewLabel_5.insets = new Insets(10, 0, 10, 0);
		gbc_lblNewLabel_5.gridx = 0;
		gbc_lblNewLabel_5.gridy = 6;
		contentPane.add(lblNewLabel_5, gbc_lblNewLabel_5);
		
		JLabel lblNewLabel_6 = new JLabel("Id préstamo:");
		GridBagConstraints gbc_lblNewLabel_6 = new GridBagConstraints();
		gbc_lblNewLabel_6.anchor = GridBagConstraints.EAST;
		gbc_lblNewLabel_6.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_6.gridx = 0;
		gbc_lblNewLabel_6.gridy = 7;
		contentPane.add(lblNewLabel_6, gbc_lblNewLabel_6);
		
		textField = new JTextField();
		textField.setEnabled(false);
		textField.setText("1");
		GridBagConstraints gbc_textField = new GridBagConstraints();
		gbc_textField.insets = new Insets(0, 0, 5, 0);
		gbc_textField.fill = GridBagConstraints.HORIZONTAL;
		gbc_textField.gridx = 1;
		gbc_textField.gridy = 7;
		contentPane.add(textField, gbc_textField);
		textField.setColumns(10);
		
		JLabel lblNewLabel_7 = new JLabel("Usuario:");
		GridBagConstraints gbc_lblNewLabel_7 = new GridBagConstraints();
		gbc_lblNewLabel_7.anchor = GridBagConstraints.EAST;
		gbc_lblNewLabel_7.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_7.gridx = 0;
		gbc_lblNewLabel_7.gridy = 8;
		contentPane.add(lblNewLabel_7, gbc_lblNewLabel_7);
		
		JComboBox jcbUsuario = new JComboBox();
		jcbUsuario.setModel(new DefaultComboBoxModel(new String[] {"Ana López - 12345678A"}));
		GridBagConstraints gbc_jcbUsuario = new GridBagConstraints();
		gbc_jcbUsuario.insets = new Insets(0, 0, 5, 0);
		gbc_jcbUsuario.fill = GridBagConstraints.HORIZONTAL;
		gbc_jcbUsuario.gridx = 1;
		gbc_jcbUsuario.gridy = 8;
		contentPane.add(jcbUsuario, gbc_jcbUsuario);
		
		JLabel lblNewLabel_8 = new JLabel("Fecha del préstamo:");
		GridBagConstraints gbc_lblNewLabel_8 = new GridBagConstraints();
		gbc_lblNewLabel_8.anchor = GridBagConstraints.EAST;
		gbc_lblNewLabel_8.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_8.gridx = 0;
		gbc_lblNewLabel_8.gridy = 9;
		contentPane.add(lblNewLabel_8, gbc_lblNewLabel_8);
		
		textField_1 = new JTextField();
		textField_1.setText("2025-03-01");
		GridBagConstraints gbc_textField_1 = new GridBagConstraints();
		gbc_textField_1.insets = new Insets(0, 0, 5, 0);
		gbc_textField_1.fill = GridBagConstraints.HORIZONTAL;
		gbc_textField_1.gridx = 1;
		gbc_textField_1.gridy = 9;
		contentPane.add(textField_1, gbc_textField_1);
		textField_1.setColumns(10);
		
		JLabel lblNewLabel_9 = new JLabel("Fecha de devolución:");
		GridBagConstraints gbc_lblNewLabel_9 = new GridBagConstraints();
		gbc_lblNewLabel_9.anchor = GridBagConstraints.EAST;
		gbc_lblNewLabel_9.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel_9.gridx = 0;
		gbc_lblNewLabel_9.gridy = 10;
		contentPane.add(lblNewLabel_9, gbc_lblNewLabel_9);
		
		textField_2 = new JTextField();
		textField_2.setText("2025-03-15");
		GridBagConstraints gbc_textField_2 = new GridBagConstraints();
		gbc_textField_2.insets = new Insets(0, 0, 5, 0);
		gbc_textField_2.fill = GridBagConstraints.HORIZONTAL;
		gbc_textField_2.gridx = 1;
		gbc_textField_2.gridy = 10;
		contentPane.add(textField_2, gbc_textField_2);
		textField_2.setColumns(10);
		
		JCheckBox chckbxNewCheckBox = new JCheckBox("Préstamo activo");
		GridBagConstraints gbc_chckbxNewCheckBox = new GridBagConstraints();
		gbc_chckbxNewCheckBox.insets = new Insets(0, 0, 5, 0);
		gbc_chckbxNewCheckBox.anchor = GridBagConstraints.WEST;
		gbc_chckbxNewCheckBox.gridx = 1;
		gbc_chckbxNewCheckBox.gridy = 11;
		contentPane.add(chckbxNewCheckBox, gbc_chckbxNewCheckBox);
		
		JButton btnGuardar = new JButton("Guardar cambios del préstamo");
		GridBagConstraints gbc_btnGuardar = new GridBagConstraints();
		gbc_btnGuardar.gridwidth = 2;
		gbc_btnGuardar.insets = new Insets(0, 0, 0, 5);
		gbc_btnGuardar.gridx = 0;
		gbc_btnGuardar.gridy = 12;
		contentPane.add(btnGuardar, gbc_btnGuardar);
	}

}
