I would expect selectedRow() to throw an exception (or return null, but I that would just lead to an annoying NPE that the developer needs to track down) if no row is selected. If multiple rows are selected, it would throw an exception.
I would expect selectedRow() to throw an exception (or return null, but I that would just lead to an annoying NPE that the developer needs to track down) if no row is selected. If multiple rows are selected, it would throw an exception.
Original report: Issue 226 (Google Code)
It is really not possible to add the method selectedRow to TableCell, without getting into a "weird" API. TableCell only cares about row and column indices, and has no idea which is the selected row of any JTable, because it is not bound to any JTable. I tried to add a "useSelectedRow" flag, but the state of the TableCell looks pretty weird to me.
Instead, I added the method selectedRow to JTableFixture, so at least we can write something like:
Alex Ruiz added a comment - 11/Jul/09 02:36 PM It is really not possible to add the method selectedRow to TableCell, without getting into a "weird" API. TableCell only cares about row and column indices, and has no idea which is the selected row of any JTable, because it is not bound to any JTable. I tried to add a "useSelectedRow" flag, but the state of the TableCell looks pretty weird to me.
Instead, I added the method selectedRow to JTableFixture, so at least we can write something like:
It is really not possible to add the method selectedRow to TableCell, without getting into a "weird" API. TableCell only cares about row and column indices, and has no idea which is the selected row of any JTable, because it is not bound to any JTable. I tried to add a "useSelectedRow" flag, but the state of the TableCell looks pretty weird to me.
Instead, I added the method selectedRow to JTableFixture, so at least we can write something like: