|
-
JTable problem
hi,
I need to list a all the files one by one in a JTable...I am sending you
the code..below..it is displaying only one row with the first 4 files, how
do I get the list of other files into the other rows...pls let me know...
createTableData();
createTableHeadings();
JTable tblDisplay ;
tblDisplay = new JTable(tableData, tableHeadings);
tblDisplay.setRowHeight(20);
private void createTableData()
{
FileTransferControl ftc = new FileTransferControl();
String dirName = "D:/Msat/config/";
fileNames= ftc.listDirectory(dirName);
Vector row1 = new Vector();
Vector row2 = new Vector();
Vector row3 = new Vector();
Vector row4 = new Vector();
Vector row5 = new Vector();
for(int i=0;i<fileNames.length;i++)
{
System.out.println(fileNames[i]);
row1.addElement(fileNames[i]);
// I dont know the logic to implement here...pls help
}
tableData.addElement(row1);
tableData.addElement(row2);
tableData.addElement(row3);
tableData.addElement(row4);
}
private void createTableHeadings()
{
tableHeadings.addElement("Filename");
tableHeadings.addElement("OAM");
tableHeadings.addElement("Telepath");
tableHeadings.addElement("MSAT");
}
Satish
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks