vorrei creare un piccolo sistema di registrazione eventi.
cioè ogni volta che si clicca su un evento (ad esempio questo per inserire dati):
venga salvato su disco un file.codice:private void btnAddBookActionPerformed(java.awt.event.ActionEvent evt) { if (textBookName.getText().length() == 0) { JOptionPane.showMessageDialog(null, "Missing elemente book name"); } else if (comboAuthor.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(null, "Choose an auhtor"); } else if (comboEditor.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(null, "Choose an editor"); } else { try { String name = textBookName.getText().toLowerCase().trim(); Author author = (Author) comboAuthor.getSelectedItem(); int author_id = author.getId(); Editor editor = (Editor) comboEditor.getSelectedItem(); int editor_id = editor.getId(); double price = Double.parseDouble(textAddPrice.getText()); String isbn = textIsbn.getText().toLowerCase().trim(); String note = areaNote.getText().trim(); dbman.insert(name, author_id, editor_id, price, isbn, note); JOptionPane.showMessageDialog(null, "Book added: " + textBookName.getText()); textBookName.setText(""); comboAuthor.setSelectedIndex(0); comboEditor.setSelectedIndex(0); textAddPrice.setText(""); textIsbn.setText(""); areaNote.setText(""); } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex.getMessage()); } catch (ClassNotFoundException ex) { JOptionPane.showMessageDialog(null, ex.getMessage()); } } }
in questo file aggiungo tutti gli eventi e poi in chiusura di programma lo invio.
che classi/metodi posso usare per registrare questi eventi?

Rispondi quotando