private void calcularActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_calcularActionPerformed // TODO add your handling code here: if (CodigoPrestamo.getText().trim().length() == 0) { JOptionPane.showMessageDialog(this, "Ingresa el Código del Préstamo"); } else if (FechaSalida.getText().trim().length() == 0) { JOptionPane.showMessageDialog(this, "Ingresa la Fecha de Salida"); } else if (Cedula.getText().trim().length() == 0) { JOptionPane.showMessageDialog(this, "Ingresa tu Cédula"); } else if (CodigoLibro.getText().trim().length() == 0) { JOptionPane.showMessageDialog(this, "Ingresa el Código del Libro"); } else if (FechaMaximaDevolucion.getText().trim().length() == 0) { JOptionPane.showMessageDialog(this, "Ingresa la Fecha Máxima de Devolución"); } else { operacioneComboBox(); } } // GEN-LAST:event_calcularActionPerformed
public void operacioneComboBox() { if (menuoperaciones.getSelectedItem().equals("Eliminar Elemento")) { eliminar(); } if (menuoperaciones.getSelectedItem().equals("Eliminar Lista")) { eliminar2(); } if (menuoperaciones.getSelectedItem().equals("Eliminar Inicio")) { listaPrestamos.eliminarInicio(); panel.setViewportView(new PanelDibujoPrestamos(listaPrestamos.size(), "", listaPrestamos)); } if (menuoperaciones.getSelectedItem().equals("Eliminar Final")) { listaPrestamos.eliminarFinal(); panel.setViewportView(new PanelDibujoPrestamos(listaPrestamos.size(), "", listaPrestamos)); } if (menuoperaciones.getSelectedItem().equals("Insertar Elemento")) { establecerClienteInicio(); } if (menuoperaciones.getSelectedItem().equals("Contar Elementos")) { JOptionPane.showMessageDialog(null, "El tamaño de la lista es:" + (listaPrestamos.size())); } if (menuoperaciones.getSelectedItem().equals("Modificar Elemento")) { int valor = Integer.parseInt(JOptionPane.showInputDialog("Ingrese clave del elemento a modificar")); Prestamos pre = new Prestamos( CodigoPrestamo.getText(), CodigoLibro.getText(), Cedula.getText(), FechaSalida.getText(), FechaMaximaDevolucion.getText()); listaPrestamos.modificar(valor, pre); panel.setViewportView(new PanelDibujoPrestamos(listaPrestamos.size(), "", listaPrestamos)); } if (menuoperaciones.getSelectedItem().equals("Buscar por Código del Préstamo")) { buscarPrestamo(); } }
public void establecerClienteInicio() { int valor = Integer.parseInt(JOptionPane.showInputDialog("Ingrese posicion de nodo a ingresar")); Prestamos pre = new Prestamos( CodigoPrestamo.getText(), CodigoLibro.getText(), Cedula.getText(), FechaSalida.getText(), FechaMaximaDevolucion.getText()); listaPrestamos.insertarInicio(pre, valor); JOptionPane.showMessageDialog(null, "Se agregó un elemento a la lista"); CodigoPrestamo.setText(null); CodigoLibro.setText(null); Cedula.setText(null); FechaSalida.setText(null); FechaMaximaDevolucion.setText(null); panel.setViewportView(new PanelDibujoPrestamos(listaPrestamos.size(), "", listaPrestamos)); }