Questo è il codice, ho tolto la parte di sotto... C'è un if perchè ho anche altri casi... comunque non capisco perchè mi dà errore alla parentesi graffa... dice: "Syntax error, insert "Finally" to complete TryStatement.... Non ho capito che vuol dire, se aggiungo la parola Fnally non cambia niente
codice HTML:public void actionPerformed(ActionEvent event) { String com=event.getActionCommand(); if(com==S) { JTable table=f.getPanel().getTabella(); try { Document doc = new Document(); PdfWriter.getInstance(doc, new FileOutputStream("table.pdf")); doc.open(); PdfPTable pdfTable = new PdfPTable(table.getColumnCount()); //adding table headers for (int i = 0; i < table.getColumnCount(); i++) { pdfTable.addCell(table.getColumnName(i)); } //extracting data from the JTable and inserting it to PdfPTable for (int rows = 0; rows < table.getRowCount() - 1; rows++) { for (int cols = 0; cols < table.getColumnCount(); cols++) { pdfTable.addCell(table.getModel().getValueAt(rows, cols).toString()); } } doc.add(pdfTable); doc.close(); System.out.println("done"); } } }