0

I am building a simple program. I should represent data in JTable, but the table is not showing up in JFrame and I can't figure out why.

MAIN METHOD

setLayout(new BorderLayout());
    panel.setLayout(new FlowLayout(FlowLayout.LEFT));

    Stredisko prvni = new Stredisko("Krkonoše", 1, "Aldrov");
    strediska.pridejStredisko(prvni);


    panel.add(b_pridej);
    panel.add(b_smaz);
    panel.add(b_konec);

    add(new JScrollPane(tbl),BorderLayout.CENTER);

    setDefaultCloseOperation(EXIT_ON_CLOSE);

    tbl.setModel(model);


    add(panel, BorderLayout.CENTER);
    setVisible(true);
    pack();
    model.fireTableDataChanged();
Tomáš Nosek
  • 213
  • 2
  • 12

1 Answers1

2

Adding two components at BorderLayout.CENTER will only display the last added one.

Consider adding your other panel elsewhere, say BorderLayout.NORTH for instance.

Arnaud
  • 17,229
  • 3
  • 31
  • 44