Hi,
I am designing an Email client and am not a very experienced Java programmer. I am using JTables to display my incoming email. I store my incoming mail in a 2D array results[][] which is got by using a executeQuery(sql query) statement. When I click on a folder (eg INBOX), I want to refresh the JTable and display only the inbox contents. I do this by using the following code:
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)jTree_folderList.getLastSelectedPathComponent();
Object nodeInfo = node.getUserObject();
if (node.isLeaf()) {
// node.toString() is the name of the folder you clicked.
String folder = node.toString();
// Create columns names
String columnNames[] = { "From", "Subject", "Date" };
// Create some data
String dataValues[][] = db.getFolderContents(username, folder);
kgTable = new JTable( dataValues, columnNames );
This code does not put the the results into the JTable and refresh it, but there is no error message either! Pls help me, I have 2 weeks to go b4 submission!