R
Rusty Wright
It seems to me that enums are what I should use for the indices of an
array where the array indices correspond to the columns in a JTable.
My JTable implements a simple sign-in wait list and has 3 columns,
Name, Sign-In Time, and Delete. (In the JTable Delete is a check box
for deleting someone from the wait list.)
My enum is as follows:
public enum Cols {
NAME, TIME, DELETE
}
If I have a row from the table, which is an array of 3 objects, and I
want to check to see if that row is to be deleted, the code for
getting the row looks something like this:
Object[] row;
row = get_Row();
The code to check to see if it's to be deleted is
if (row[Cols.DELETE.ordinal()].toString().equals("true"))
Nevermind all the baloney with toString() and equals(); what bothers
me is that I have to use ordinal(). That just seems so klunky.
Am I going about this the wrong way?
array where the array indices correspond to the columns in a JTable.
My JTable implements a simple sign-in wait list and has 3 columns,
Name, Sign-In Time, and Delete. (In the JTable Delete is a check box
for deleting someone from the wait list.)
My enum is as follows:
public enum Cols {
NAME, TIME, DELETE
}
If I have a row from the table, which is an array of 3 objects, and I
want to check to see if that row is to be deleted, the code for
getting the row looks something like this:
Object[] row;
row = get_Row();
The code to check to see if it's to be deleted is
if (row[Cols.DELETE.ordinal()].toString().equals("true"))
Nevermind all the baloney with toString() and equals(); what bothers
me is that I have to use ordinal(). That just seems so klunky.
Am I going about this the wrong way?