error upon assigning Layout: BoxLayout can’t be shared
Your problem is that you’re creating a BoxLayout for a JFrame (this), but setting it as the layout for a JPanel (getContentPane()). Try:
Your problem is that you’re creating a BoxLayout for a JFrame (this), but setting it as the layout for a JPanel (getContentPane()). Try: