private void saveChanges()

in src/com/example/library/forms/BookEditorExample.java [57:80]


    private void saveChanges() {
        String authorName = authorNameField.getText();
        String bookName = bookNameField.getText();
        Genre genre = (Genre) genreComboBox.getSelectedItem();
        boolean isTaken = isTakenCheckBox.isSelected();

        // Create Author object
        Author author = new Author(authorName, ""); // Set the author name

        // Create Book object
        Book book = new Book(author, genre, null, bookName);
        book.setTaken(isTaken);

        // Notify the listener with the book object
        if (saveButtonListener != null) {
            saveButtonListener.onSaveClicked(book);
        }

        // Reset fields
        authorNameField.setText("");
        bookNameField.setText("");
        genreComboBox.setSelectedIndex(0);
        isTakenCheckBox.setSelected(false);
    }