Hello All -
So I'm making a file browser/chooser. I am useing a JTable to display a list of files that i query from a sql database. I am using a JTable because i want to display the information as name, and description in the window. I am using a JComboBox as a filter device of what to display in the window.
So the problem is when it opens up nothing is displayed but the default table information (title1, title2, title3, title4).
These are the steps the code goes in when executed (note that everything is done in netbeans):
String[] columnNames = {"Name", "Description"};
Object[][] data = null;
{... SQL Queries here...}
ArrayList<String[]> m_data = loadSQLData(query);
data = new Object[m_data.size()][columnNames.length];
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[i].length; j++) {
data[i][j] = m_data.get(i)[j];
}
}
DefaultTableModel tabModel = new DefaultTableModel(data, columnNames);
jTable1 = new JTable(tabModel);
jTable1.setVisible(true);
So basically the code queries the database and returns an ArrayList<String[]> with each string array representing a row. In my console window I see the code query the server, connect and grab the information i queried (I have the console output retrieval info). I step throught he code and the jTabel1 is valid and has all the information I queried from the server. I can even retrieve the information in each cell using the jTable1.getValueAt(row, col);. So i know the data is there.
The problem is that i don't see any of that information in the cells. It just displays the default info set by netbeans. I've even tried setting a TableCellRenderer and nothing changes. There is a scrollpane which the table resides in and its already been added, not sure if it was necessary, but
figured it would be nice to have in place just in case.
Thanks In Advance,
Gatts