Reputation: 15
String[] names = app1.getSimplifiedMovieRecordsList();
I have this string array with names of movies. I need to display this as the rows of a table having one column. Can someone please tell me how to do this.
Upvotes: 0
Views: 1358
Reputation: 8348
need to display this as the rows of a table having one column
Presuming you mean JTable
as your title suggests:
For example:
Object[][] tableData = new Object[names.length][1];
for ( int i = 0; i < names.length; i++ ){
tableData[i][0] = names[i];
}
Object[] colnames = {"MyColumnNmae"};
JTable table = new JTable(tableData, colnames);
You can alternatively:
Upvotes: 2