I'm having a problem with displaying a JTable
in a JPanel
. I'm having the user press a button and within this button the table should generate the table and put in an already existing panel, now when I tried to open it in a new JFrame
the data shows perfectly but I want to show it in a JPanel
.
Code:
files = c.RequestFile("list"); //gets the data of files
Object[][] filesArray = new Object[files.size()][1];
int size = 0;
for (FileInfo fileInfo : files) {
filesArray[size][0] = fileInfo.getName();
size++;
}
fileTablePanel.setLayout(new BorderLayout());
fileTablePanel.add(new JScrollPane(createTable(filesArray)));