a interface para listar e cadastrar, lembrando que somente o listar livro (ListLivro) não funciona.
Menu.JAVA
packagegui;importbiblioteca.*;importpessoa.*;importjava.util.*;importconexoes.*;publicclassMenuextendsjavax.swing.JFrame{/** Creates new form Menu */publicMenu(){initComponents();/*Arquivo a = new Arquivo ("Colecao.txt"); a.abreArquivo("Read"); listaLivros =(LinkedList<Livro>) a.leRegistro(); a.fechaArquivo();*/}@SuppressWarnings("unchecked")// <editor-fold defaultstate="collapsed" desc="Generated Code"> privatevoidinitComponents(){jMenuBar1=newjavax.swing.JMenuBar();jMenu1=newjavax.swing.JMenu();MnuSair=newjavax.swing.JMenuItem();cadAutor=newjavax.swing.JMenu();mnuC=newjavax.swing.JMenuItem();cadLivro=newjavax.swing.JMenuItem();jMenu3=newjavax.swing.JMenu();listAutor=newjavax.swing.JMenuItem();ListLivro=newjavax.swing.JMenuItem();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);jMenu1.setMnemonic('a');jMenu1.setText("Arquivo");MnuSair.setMnemonic('s');MnuSair.setText("Sair");MnuSair.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){MnuSairActionPerformed(evt);}});jMenu1.add(MnuSair);jMenuBar1.add(jMenu1);cadAutor.setMnemonic('o');cadAutor.setText("Cadastrar");mnuC.setText("Autor");mnuC.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){mnuCActionPerformed(evt);}});cadAutor.add(mnuC);cadLivro.setText("Livro");cadLivro.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){cadLivroActionPerformed(evt);}});cadAutor.add(cadLivro);jMenuBar1.add(cadAutor);jMenu3.setMnemonic('o');jMenu3.setText("Listar");jMenu3.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){jMenu3ActionPerformed(evt);}});listAutor.setText("Autor");listAutor.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){listAutorActionPerformed(evt);}});jMenu3.add(listAutor);ListLivro.setText("Livro");ListLivro.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEventevt){ListLivroActionPerformed(evt);}});jMenu3.add(ListLivro);jMenuBar1.add(jMenu3);setJMenuBar(jMenuBar1);javax.swing.GroupLayoutlayout=newjavax.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,400,Short.MAX_VALUE));layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,279,Short.MAX_VALUE));pack();}// </editor-fold> privatevoidMnuSairActionPerformed(java.awt.event.ActionEventevt){// TODO add your handling code here:Arquivoa=newArquivo("Colecao.txt");a.abreArquivo("write");//Abre para escrever arquivoa.gravaRegistro(listaLivros);a.fechaArquivo();System.exit(0);}privatevoidmnuCActionPerformed(java.awt.event.ActionEventevt){// TODO add your handling code here:newCadAutor(listaAutores).setVisible(true);}privatevoidcadLivroActionPerformed(java.awt.event.ActionEventevt){// TODO add your handling code here:newCadLivro(listaLivros).setVisible(true);}privatevoidlistAutorActionPerformed(java.awt.event.ActionEventevt){newListAutor(listaAutores).setVisible(true);// TODO add your handling code here:}privatevoidListLivroActionPerformed(java.awt.event.ActionEventevt){// TODO add your handling code here:[b][i][u]newListLivro(listaLivros).setVisible(true);[/b][/i][/u]}privatevoidjMenu3ActionPerformed(java.awt.event.ActionEventevt){// TODO add your handling code here:}/** * @param args the command line arguments */publicstaticvoidmain(Stringargs[]){java.awt.EventQueue.invokeLater(newRunnable(){publicvoidrun(){newMenu().setVisible(true);}});}// Variables declaration - do not modify privatejavax.swing.JMenuItemListLivro;privatejavax.swing.JMenuItemMnuSair;privatejavax.swing.JMenucadAutor;privatejavax.swing.JMenuItemcadLivro;privatejavax.swing.JMenujMenu1;privatejavax.swing.JMenujMenu3;privatejavax.swing.JMenuBarjMenuBar1;privatejavax.swing.JMenuItemlistAutor;privatejavax.swing.JMenuItemmnuC;// End of variables declaration privateLinkedList<Autor>listaAutores=newLinkedList<Autor>();privateLinkedList<Livro>listaLivros=newLinkedList<Livro>();}