Java Error: IllegalArgumentException: adding a window to a container

后端 未结 3 587
温柔的废话
温柔的废话 2021-01-12 06:49

I keep receiving the error:

Exception in thread \"main\" java.lang.IllegalArgumentException: adding a window to a container
  at java.awt.Container.checkNotA         


        
3条回答
  •  有刺的猬
    2021-01-12 07:41

    EmployeeGUI extends from JFrame, but in your main method, you are creating a new JFrame and are trying to add an instance of EmployeeGUI to it.

    Change EmployeeGUI so it extends from JPanel instead

提交回复
热议问题