• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Flight Table Column Indexing

 
Rudy Yeung
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find there is no way to tell which column is airport origin and destination unless it is by means of hardcoding the index like 1 and 2 in the following coding. This also happens to the seat column. Is there anyway I can obtain the value of index 1 and 2 without hardcoding.
 
R Bischof
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shure. just code a method
int getColumnIndex(String colName)...
into your TableModel.
But then you no longer have integer constants hardcoded but String constants. So this does not really help.
But since this is done on the client only, I think it's OK.
I think you have always fixed references somewhere in your code, even if it's just a simple SQL statement.

Rainer
 
R Bischof
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ooops, I just found a
public int findColumn(String columnName)
in the Abstract TableModel.
HTH
Rainer
 
Rudy Yeung
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah, the string constant is also a means of hardcoding, but in a more meaningful way. I am gonna to set the index 1 and 2 to a constant.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic