更新时间:2023-11-30 16:49:34
我想通了.此处接受的答案下的评论对此进行了解释:动态添加的 JTable 不显示
I figured it out. The comments under the accepted answer here explain it: Dynamically added JTable not displaying
基本上我只是在 mainPanel.add() 之前添加了以下内容
Basically I just added the following before the mainPanel.add()
mainPanel.setLayout(new java.awt.BorderLayout());