On Fri, 13 Mar 2026 07:12:53 GMT, Tejesh R <[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
>
> src/java.desktop/share/classes/sun/swing/SwingUtilities2.java line 799:
> 
>> 797:     public static void adjustFocus(JComponent c) {
>> 798:         if (!c.hasFocus() && c.isRequestFocusEnabled()) {
>> 799:             c.requestFocus(FocusEvent.Cause.MOUSE_EVENT);
> 
> Is it always through MOUSE_EVENT or can there be Key press also ?

adjustFocus as of now is internal call and called for mouse events only

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30157#discussion_r2929512394

Reply via email to