My school project for programming a GUI for a librarian to use in NetBeans gets stuck loading at 50% everytime I try to run it

/*

  • Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
  • Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
    */
    package lb.librarysystem;

import java.awt.CardLayout;

/**
*

  • @author Jayden Ryan Gurung
    */
    public class LibraryGUI extends javax.swing.JFrame {

    private Library myLibrary;
    private UserTableModel userTableModel;
    private BookTableModel bookTableModel;

    /**

    • Creates new form LibraryGUI
      */
      public LibraryGUI() {
      myLibrary = new Library(); // Initialize the library
      userTableModel = new UserTableModel(new LibraryUser[0]); // Initialize the user table model
      bookTableModel = new BookTableModel(new Book[0]);

      initComponents();
      addTestUsers();
      updateUserTable();
      }

    /**

    • This method is called from within the constructor to initialize the form.

    • WARNING: Do NOT modify this code. The content of this method is always

    • regenerated by the Form Editor.
      */
      @SuppressWarnings(“unchecked”)
      //
      private void initComponents() {

      Users = new javax.swing.JButton();
      Books = new javax.swing.JButton();
      parentPanel = new javax.swing.JPanel();
      userPanel = new javax.swing.JPanel();
      jScrollPane2 = new javax.swing.JScrollPane();
      UserTableModel = new javax.swing.JTable();
      editButton = new javax.swing.JButton();
      editedUser = new javax.swing.JTextField();
      addUserButton = new javax.swing.JButton();
      removeUserButton = new javax.swing.JButton();
      bookPanel = new javax.swing.JPanel();
      jScrollPane1 = new javax.swing.JScrollPane();
      jTable1 = new javax.swing.JTable();
      editedBook = new javax.swing.JTextField();
      addBookButton = new javax.swing.JButton();
      removeBookButton = new javax.swing.JButton();
      editBookButton = new javax.swing.JButton();
      jSlider1 = new javax.swing.JSlider();

      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

      Users.setBackground(new java.awt.Color(153, 153, 255));
      Users.setText(“Users”);
      Users.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      UsersActionPerformed(evt);
      }
      });

      Books.setBackground(new java.awt.Color(153, 255, 153));
      Books.setText(“Books”);
      Books.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      BooksActionPerformed(evt);
      }
      });

      parentPanel.setBackground(new java.awt.Color(153, 153, 255));
      parentPanel.setLayout(new java.awt.CardLayout());

      userPanel.setBackground(new java.awt.Color(153, 153, 255));

      UserTableModel.setAutoCreateRowSorter(true);
      UserTableModel.setModel(new javax.swing.table.DefaultTableModel(
      new Object [][] {
      {null, null, null, null},
      {null, null, null, null},
      {null, null, null, null},
      {null, null, null, null}
      },
      new String [] {
      “Title 1”, “Title 2”, “Title 3”, “Title 4”
      }
      ));
      jScrollPane2.setViewportView(UserTableModel);
      UserTableModel.getAccessibleContext().setAccessibleName(“UserTableModel”);
      UserTableModel.getAccessibleContext().setAccessibleDescription(“”);
      UserTableModel.getAccessibleContext().setAccessibleParent(UserTableModel);

      editButton.setText(“Edit”);
      editButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      editButtonActionPerformed(evt);
      }
      });

      editedUser.setText(“Username Here”);
      editedUser.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      editedUserActionPerformed(evt);
      }
      });

      addUserButton.setText(“Add”);
      addUserButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      addUserButtonActionPerformed(evt);
      }
      });

      removeUserButton.setText(“Remove”);
      removeUserButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      removeUserButtonActionPerformed(evt);
      }
      });

      javax.swing.GroupLayout userPanelLayout = new javax.swing.GroupLayout(userPanel);
      userPanel.setLayout(userPanelLayout);
      userPanelLayout.setHorizontalGroup(
      userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(userPanelLayout.createSequentialGroup()
      .addContainerGap()
      .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 326, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addGroup(userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(userPanelLayout.createSequentialGroup()
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
      .addGroup(userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
      .addGroup(userPanelLayout.createSequentialGroup()
      .addComponent(editedUser)
      .addGap(22, 22, 22))
      .addGroup(userPanelLayout.createSequentialGroup()
      .addComponent(removeUserButton)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 48, Short.MAX_VALUE)
      .addComponent(editButton)
      .addGap(12, 12, 12))))
      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, userPanelLayout.createSequentialGroup()
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
      .addComponent(addUserButton)
      .addGap(72, 72, 72))))
      );
      userPanelLayout.setVerticalGroup(
      userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
      .addGroup(userPanelLayout.createSequentialGroup()
      .addGap(39, 39, 39)
      .addComponent(editedUser, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
      .addComponent(addUserButton)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
      .addGroup(userPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
      .addComponent(removeUserButton)
      .addComponent(editButton))
      .addGap(215, 215, 215))
      .addGroup(userPanelLayout.createSequentialGroup()
      .addContainerGap()
      .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
      .addContainerGap())
      );

      parentPanel.add(userPanel, “userPanel”);

      bookPanel.setBackground(new java.awt.Color(153, 255, 153));

      jTable1.setModel(new javax.swing.table.DefaultTableModel(
      new Object [][] {
      {null, null, null, null},
      {null, null, null, null},
      {null, null, null, null},
      {null, null, null, null}
      },
      new String [] {
      “Title 1”, “Title 2”, “Title 3”, “Title 4”
      }
      ));
      jScrollPane1.setViewportView(jTable1);

      editedBook.setText(“Book title here”);
      editedBook.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      editedBookActionPerformed(evt);
      }
      });

      addBookButton.setText(“Add”);

      removeBookButton.setText(“Remove”);

      editBookButton.setText(“Edit”);

      javax.swing.GroupLayout bookPanelLayout = new javax.swing.GroupLayout(bookPanel);
      bookPanel.setLayout(bookPanelLayout);
      bookPanelLayout.setHorizontalGroup(
      bookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(bookPanelLayout.createSequentialGroup()
      .addContainerGap()
      .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 329, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addGroup(bookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(bookPanelLayout.createSequentialGroup()
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
      .addGroup(bookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
      .addComponent(editedBook, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addGroup(bookPanelLayout.createSequentialGroup()
      .addComponent(addBookButton)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
      .addComponent(removeBookButton))))
      .addGroup(bookPanelLayout.createSequentialGroup()
      .addGap(68, 68, 68)
      .addComponent(editBookButton)))
      .addContainerGap(18, Short.MAX_VALUE))
      );
      bookPanelLayout.setVerticalGroup(
      bookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(bookPanelLayout.createSequentialGroup()
      .addContainerGap()
      .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
      .addContainerGap())
      .addGroup(bookPanelLayout.createSequentialGroup()
      .addGap(43, 43, 43)
      .addComponent(editedBook, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addGap(26, 26, 26)
      .addGroup(bookPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
      .addComponent(addBookButton)
      .addComponent(removeBookButton))
      .addGap(28, 28, 28)
      .addComponent(editBookButton)
      .addContainerGap(194, Short.MAX_VALUE))
      );

      parentPanel.add(bookPanel, “bookPanel”);

      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
      .addGap(34, 34, 34)
      .addComponent(Users)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
      .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
      .addGap(87, 87, 87)
      .addComponent(Books)
      .addGap(61, 61, 61))
      .addGroup(layout.createSequentialGroup()
      .addContainerGap()
      .addComponent(parentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
      );
      layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
      .addGap(28, 28, 28)
      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
      .addComponent(Users)
      .addComponent(Books)
      .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
      .addGap(21, 21, 21)
      .addComponent(parentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
      );

      pack();
      }//

    private void UsersActionPerformed(java.awt.event.ActionEvent evt) {
    CardLayout card = (CardLayout) parentPanel.getLayout();
    card.show(parentPanel, “userPanel”);

    }

    private void BooksActionPerformed(java.awt.event.ActionEvent evt) {
    CardLayout card = (CardLayout) parentPanel.getLayout();
    card.show(parentPanel, “bookPanel”);
    }

    private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    }

    private void editedUserActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    }

    private void removeUserButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    }

    private void editedBookActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    }

    private void addUserButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    String username = editedUser.getText();
    LibraryUser newUser = new LibraryUser(username);
    newUser.setEmail(username + “@gmail.com “);
    myLibrary.addUser(newUser);
    updateUserTable();
    }

    private void addTestUsers() {
    String[] names = {“Kanye”, “Jonathan”, “William”, “Aryan”, “Abhinav”, “Dustin”};
    for (int i = 0; i < 6; i++) {
    LibraryUser newUser = new LibraryUser(names[i]);
    newUser.setEmail(names[i] + “@gmail.com”);
    myLibrary.addUser(newUser);
    }
    }

    private void updateUserTable()
    {
    userTableModel.updateTable(myLibrary.getUsers());
    }

    /**

    • @param args the command line arguments
      /
      public static void main(String args[]) {
      /
      Set the Nimbus look and feel /
      //
      /
      If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

      • For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
        */
        try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
        if (“Nimbus”.equals(info.getName())) {
        javax.swing.UIManager.setLookAndFeel(info.getClassName());
        break;
        }
        }
        } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(LibraryGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(LibraryGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(LibraryGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(LibraryGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //

      /* Create and display the form */
      java.awt.EventQueue.invokeLater(new Runnable() {
      @Override
      public void run() {
      new LibraryGUI().setVisible(true);
      }
      });

    }

    // Variables declaration – do not modify
    private javax.swing.JButton Books;
    private javax.swing.JTable UserTableModel;
    private javax.swing.JButton Users;
    private javax.swing.JButton addBookButton;
    private javax.swing.JButton addUserButton;
    private javax.swing.JPanel bookPanel;
    private javax.swing.JButton editBookButton;
    private javax.swing.JButton editButton;
    private javax.swing.JTextField editedBook;
    private javax.swing.JTextField editedUser;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSlider jSlider1;
    private javax.swing.JTable jTable1;
    private javax.swing.JPanel parentPanel;
    private javax.swing.JButton removeBookButton;
    private javax.swing.JButton removeUserButton;
    private javax.swing.JPanel userPanel;
    // End of variables declaration
    }

Above is the code for my GUI. If the code of any other classes such as the LibraryUser class, library class, book class etc is needed I can provide it. Everytime I try to run the GUI, my IDE gets stuck loading at 50% and stays like that. However, it returns no compilation errors. What’s wrong with it?

Tried asking GPT 4o and Google Gemini but they didnt really help.

New contributor

suki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật