My code is as follows
String[] columnNames = { "Flight #" , "Origin Airport" , "Destination Airport" , "Carrier #" , "Price" , "Day" , "Time" , "Duration" , "Available Seats" };
JTable table = new JTable();
for ( int i = 0; i < columnNames.length; i++ ) {
table.setValueAt( columnNames[i] , 0, i);
}
When I execute it , I get the following error
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Vector.java:417)
at javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColumnModel.java:276)
at javax.swing.JTable.convertColumnIndexToModel(JTable.java:1623)
at javax.swing.JTable.setValueAt(JTable.java:1737)
at suncertify.client.FBNClient.<init>(FBNClient.java:53)
at suncertify.client.FBNClient.main(FBNClient.java:94)
Something wrong with the row and column indexes used by me .
Any clues?
-- Ravindra