On Sat, 12 Feb 2022 00:52:34 GMT, Anton Litvinov <alitvi...@openjdk.org> wrote:
>> src/java.desktop/share/classes/javax/swing/JTable.java line 5508: >> >>> 5506: (table != null) && table.isEnabled() && >>> 5507: table.isCellEditable(row, column)) { >>> 5508: >>> table.setValueAt(Boolean.valueOf(newSelectedState), >> >> Where this code is triggered if the user click on the checkbox by the mouse? > > Mouse click on JCheckBox is handled differently from execution of "click" > accessible action on this JCheckBox, because behind mouse click different AWT > mouse events stand which are processed properly, while "doAccessibleAction()" > does not involve these mouse events and all their code. So if you are > worrying about focus or selection as a result of "doAccessibleAction()", then > I checked the behavior of "doAccessibleAction" on JCheckBox, JButton located > outside JTable and I confirm that it does not lead to setting of focus to > these components, hence there is no need to set focus to this "JCheckBox" > "BooleanRenderer" when it is in table cell and no need to change selection in > JTable. > > I suppose that this code should be invoked only by calling > "doAccessibleAction(int)" on object of "AccessibleAction" interface either > through Java Accessibility API like it is in this regression test or through > Java Access Bridge API from the native assistive software application like it > is in the manual test attached to the bug and in that case it is called from > the method "private boolean doAccessibleActions(final AccessibleContext ac, > final String name)" in the file > "src/jdk.accessibility/windows/classes/com/sun/java/accessibility/internal/AccessBridge.java". > The reason of the issue is the fact that when the assistive technology > software tries to do "AccessibleAction" on "AccessibleContext" associated > with a cell with boolean data type in "JTable" component through Java Access > Bridge (JAB), the JDK executes this "AccessibleAction" on "AccessibleContext" > of a renderer, which is an instance of the class > "javax.swing.JTable.BooleanRenderer" which is a derivative of "JCheckBox" > class, and the instance of this renderer is single and common for all cells > of boolean data type. Therefore execution of "click" "AccessibleAction" on > this renderer component which is not permanently bound to any particular cell > in the table does not lead to update of the table cell value. But how do the real mouse clicks trigger selection/deselection of the checkbox state, I guess that the "table.setValueAt()" should be called somewhere, can we do something similar from the "doAccessibleAction()"? ------------- PR: https://git.openjdk.java.net/jdk/pull/7416