-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.2
-
generic
-
generic
Name: rlT66838 Date: 08/18/99
I have a JTable with custom editors. When I install the
custom editors into the table, I set the next Focus component
of each custom editor to point to the one, so that
the user can tab from cell to cell on the same row.
This is done via "setNextFocusableComponent"
When the last cell is reached, its "setNextFocusableComponent"
is set to the table itself.
This works fine in JDK 1.2.1.
However, in JDK 1.2.2, when I tab out of any cells,
the focus is transferred to table instead of the
next cell. Please fix this problem ASAP.
I traced thru the JTable code in JDK 1.2.2, and found the problem,
which is in "prepareEditor" method. This method sets
the next Focusable Component of the custom editor to "this".
This is wrong because the programmers already set up the
custom editors and the navigation among the them.
JTable should arbitrarily change the nextFocusableComponent.
In fact, the same method in JDK 1.2.1 does not do this.
PS. Below are "preparedEditor" for both JDK 1.2.1 and JDK 1.2.2
to show the difference.
// JDK 1.2.1
public Component prepareEditor(TableCellEditor editor, int row, int
column) {
Object value = getValueAt(row, column);
boolean isSelected = isCellSelected(row, column);
Component comp = editor.getTableCellEditorComponent(this, value,
isSelected,
row, column);
if((comp != null) && (comp.getFont() == null)) {
comp.setFont(getFont());
}
return comp;
}
// JDK 1.2.2 version
public Component prepareEditor(TableCellEditor editor, int row, int
column) {
Object value = getValueAt(row, column);
boolean isSelected = isCellSelected(row, column);
Component comp = editor.getTableCellEditorComponent(this, value,
isSelected,
row, column);
if (comp instanceof JComponent) {
((JComponent)comp).setNextFocusableComponent(this);
}
return com;
}
(Review ID: 93613)
======================================================================
- duplicates
-
JDK-4260718 JTable's prepareEditor should not call setNextFocusableComponent
-
- Resolved
-