
AYUDA! Lista enlazada y Jframe
Publicado por Enzo (1 intervención) el 05/07/2021 20:52:00
Tengo un método el cual lee las propiedades de los archivos txt, y los guarda en variables, luego se procederá a guardar en listas enlazadas que contendrán nodos, el código es el siguiente
Estoy trabajando con Java Swing y cuando corro el método de guardar funciona perfectamente, los guarda y los imprime, pero al pasar a otro formulario e intento hacer alguna operación, me indica que la lista esta vacía. Me gustaría que me indicaran cual es mi error.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public void guardar_nodo() throws FileNotFoundException, IOException, ParseException
{
for (int i = 0; i < Prestamos.length; i++) {
File Archivos = new File(ubicacion_prestamo+ Prestamos[i].getName());
FileInputStream fis = new FileInputStream(Archivos); //Sirve para leer los datos
Properties mostrar = new Properties(); //Cargamos las propiedades
mostrar.load(fis);//Cargamos las propiedades de los datos leidos
String datos_tabla[] = {Prestamos[i].getName().replace(".Prestamos", ""),
mostrar.getProperty("Codigo Operacion"), mostrar.getProperty("Nombre"), mostrar.getProperty("Apellido"),
mostrar.getProperty("Carrera"), mostrar.getProperty("CodigoLibro"),mostrar.getProperty("Titulo"),
mostrar.getProperty("Autor"), mostrar.getProperty("Tipo"),mostrar.getProperty("Fechadeprestamo")};
//Guardamos en variables las propiedades de los txt
int cod_operacion=Integer.parseInt(Prestamos[i].getName().replace(".Prestamos", ""));
String nombre=mostrar.getProperty("Nombre");
String apellido=mostrar.getProperty("Apellido");
String carrera=mostrar.getProperty("Carrera");
int cod_libro=Integer.parseInt(mostrar.getProperty("CodigoLibro"));
String titulo=mostrar.getProperty("Titulo");
String autor=mostrar.getProperty("Autor");
String tipo=mostrar.getProperty("Tipo");
Date fecha_convertida = objSDF.parse(mostrar.getProperty("Fechadeprestamo"));
Objeto_Prestamo ob_prestamo= new Objeto_Prestamo(cod_operacion, cod_libro, nombre, apellido, carrera, titulo, autor, tipo, fecha_convertida);
ob_lista_prestamo.insertar(new Nodo(ob_prestamo));
}
ob_lista_prestamo.Imprimir();
}
Valora esta pregunta


0