RFR: 8141391: DnD doesn't work for JFXPanel
Prasanta Sadhukhan
psadhukhan at openjdk.org
Fri Jul 11 16:51:42 UTC 2025
On Fri, 11 Jul 2025 16:21:39 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> modules/javafx.swing/src/main/java/com/sun/javafx/embed/swing/SwingDnD.java line 203:
>>
>>> 201: javafx.embed.swing.JFXPanel jfxPanel = (javafx.embed.swing.JFXPanel)comp;
>>> 202:
>>> 203: if (jfxPanel.getScene().getFocusOwner() instanceof javafx.scene.control.TextField tf) {
>>
>> This cannot possibly work:
>>
>> a) does not build
>> b) what if the drop target is not a TextField, but some other editable text component (a TextArea or a rich text editor of some sort)?
>
> Yes, this the wrong approach. The javafx.swing module does not (and should not) depend on javafx.controls. Drag and Drop is a scene graph operation and can be targeted to any node, even nodes that are not Controls.
a) Yes, couple of module-info file was changed but not pushed in
b) I could use TextInputControl or the parent
Any other suggestion as clearly we cannot use Scene.DragEvent return value?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1843#discussion_r2201278285
More information about the openjfx-dev
mailing list