public BookEditorExample()

in src/com/example/library/forms/BookEditorExample.java [21:53]


    public BookEditorExample() {
        library = new Library();

        setTitle("Book Editor");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setContentPane(contentPane);
        pack();

        // Populate the genre combo box
        populateGenreComboBox();

        // Set the frame location to the center of the screen
        setLocationRelativeTo(null);

        // Save button event listener
        saveButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                saveChanges();
            }
        });

        // Cancel button event listener
        cancelButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                cancelChanges();
            }
        });

        // Set the frame visible
        setVisible(true);
    }