On Tue, 4 Aug 2026 12:15:43 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

>> Aqua classes for text components enables dragEnabled by default although 
>> setDragEnabled spec cites `"The default value of the dragEnabled property is 
>> false. "` and there is nothing in Aqua L&F that mentions otherwise as to why 
>> the default is overridden.
>> Other L&F dont override the mode and the code is there from macosx port days 
>> so it seems to be an oversight.
>> 
>> The code is deleted.
>> Test is added to check 
>>  - default value is honoured in all installed L&Fs
>>  - explicit application setting of drag mode is preserved on L&F change
>> 
>>  CI testing is ok.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Prasanta Sadhukhan has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Add note and configure via LookAndFeel.installProperty

src/java.desktop/share/classes/javax/swing/LookAndFeel.java line 278:

> 276:     public static void installProperty(JComponent c,
> 277:                                        String propertyName, Object 
> propertyValue) {
> 278:         if ("dragEnabled".equals(propertyName)

Why does this need to be handled specially ?
Why can't it go through c.setUIProperty() like everything else ?
Also the special handling of JPasswordField might be needed here too.
I don't think we want to enable Drag on a JPasswordField, even though I think 
it is ignored unless you ALSO call  ...
JComponent.putClientProperty("JPasswordField.cutCopyAllowed", Boolean.TRUE);
... because BasicTextUI.getSourceActions() vetoes the DnD.

However it seems off to me that we have code that even tries to default enable 
drag on a JPasswordField, since even calling setDragEnabled(true) on a 
JPasswordField doesn't work.
You still need to set that client property.
I don't know that we need / want to document the client property, but perhaps 
somewhere we should document that a L&F should configure JPasswordField to 
ignore drags (drops are OK, its just drags).

Do we in fact already have any API doc about this ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32101#discussion_r3723664137

Reply via email to