On Thu, 6 Aug 2026 02:29:24 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
>> 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 ?
>
> Yes, it can be done in setUIProperty and I have moved there..
> I have also added JPasswordField case in regression test too which passes
For JPasswordField, I see in LookAndFeel.installProperty, it calls
`customSetUIProperty` special case which only handles "echoChar" propertyName
so for "dragEnabled" propertyName it will return false so
JComponent.setUIProperty will handle it as a JTextComponent
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/32101#discussion_r3725498327