On Tue, 10 Mar 2026 07:51:47 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

> As per [JDK-8306119](https://bugs.openjdk.org/browse/JDK-8306119), many 
> classes were updated to request Focus with a MOUSE_EVENT cause, rather than 
> having an UNKNOWN cause.
> 
> However, Swingutiilites2 also request Focus without cause which can also be 
> updated to show appropriate cause
> Couple of SwingUtilities2 methods are updated with proper cause, which are 
> called from 
> 
> https://github.com/openjdk/jdk/blob/9a26b4af34cd3e8690c5150da232eaa8bf3a82a6/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java#L2878
> https://github.com/openjdk/jdk/blob/9a26b4af34cd3e8690c5150da232eaa8bf3a82a6/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java#L2974-L2976
> https://github.com/openjdk/jdk/blob/9a26b4af34cd3e8690c5150da232eaa8bf3a82a6/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java#L1064
> https://github.com/openjdk/jdk/blob/9a26b4af34cd3e8690c5150da232eaa8bf3a82a6/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java#L1107
> https://github.com/openjdk/jdk/blob/9a26b4af34cd3e8690c5150da232eaa8bf3a82a6/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java#L1199-L1202
> https://github.com/openjdk/jdk/blob/9a26b4af34cd3e8690c5150da232eaa8bf3a82a6/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java#L4096
> https://github.com/openjdk/jdk/blob/9a26b4af34cd3e8690c5150da232eaa8bf3a82a6/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java#L4132
> https://github.com/openjdk/jdk/blob/9a26b4af34cd3e8690c5150da232eaa8bf3a82a6/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java#L4207-L4210
> https://github.com/openjdk/jdk/blob/9a26b4af34cd3e8690c5150da232eaa8bf3a82a6/src/java.desktop/share/classes/javax/swing/JInternalFrame.java#L1430-L1432
> https://github.com/openjdk/jdk/blob/9a26b4af34cd3e8690c5150da232eaa8bf3a82a6/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java#L1680

The changes LGTM. I have looked through other possible Causes in FocusEvent, 
but I think these are the most appropriate.

src/java.desktop/share/classes/sun/swing/SwingUtilities2.java line 1650:

> 1648:                 Component comp = policy.getDefaultComponent(container);
> 1649:                 if (comp!=null) {
> 1650:                     comp.requestFocus(FocusEvent.Cause.TRAVERSAL);

Nit: It looks like only this `compositeRequestFocus` API has no spacing 
before/after the `!=` in the if-statements. Occurs multiple times and only in 
this method.

-------------

Marked as reviewed by dnguyen (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/30157#pullrequestreview-3947288207
PR Review Comment: https://git.openjdk.org/jdk/pull/30157#discussion_r2934072203

Reply via email to