无法同时显示我的JFrame和表格

问题描述 投票:0回答:1

所以我在intellij的表单中创建了一个gui,当我拿出与表有关的代码时,它就是我想要的,但是当我把代码全部放进去时,我得到的就是表本身。我在使用gui表单本身添加列时遇到了问题,并找到了一个教程,展示如何使用代码添加列等。我如何能够向表中添加行和/或在表单上包含表

public class App extends JFrame{
    private JButton createRecordButton;
    private JPanel panel1;
    private JPanel east;
    private JPanel west;
    private JPanel south;
    private JButton deleteRecordButton;
    private JButton viewStatisticsButton;
    private JButton downloadDataButton;
    public JTable TestDB;



    public App() {

    }

    public static void main(String[] args) {
        JFrame frame=new JFrame("App");
        frame.setContentPane(new App().panel1);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);

        table gui=new table();
        gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        gui.setSize(600,200);
        gui.setVisible(true);
        gui.setTitle("The DataBase Table");




    }
}
java forms intellij-idea jframe
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.