Swing JTable ничего не показывает - PullRequest
0 голосов
/ 03 марта 2020

Я добавил Jtable в свою JPanel, это простой код , но на экране ничего не отображается. Справка Справка Справка Справка Справка Справка Справка Справка Справка Справка. Вот мой код:

public class AddProduct extends JFrame {

    private JPanel contentPane;
    Connection con;
    private JTable table;

    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    AddProduct frame = new AddProduct();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    /**
     * Create the frame.
     */
    public AddProduct() {

        con = MySQLConnection.getConnection();
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 832, 466);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        contentPane.setLayout(null);
        String[] column_headers = {"Team", "Pointers", "Goal Diff"};
        String[][] team_statics = {{"Man Utd", "65", "40"}, {"Chelsea", "63", "38"}};

        table = new JTable();
        table.setBounds(0, 297, 501, -296);
        contentPane.add(table);
  }
}

Я точно делаю то, что смотрю в видео.

...