JDK-6254533 : Drag and Drop in text fields and areas
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-04-13
  • Updated: 2006-04-07
  • Resolved: 2005-04-14
Description
A DESCRIPTION OF THE REQUEST :
For
- javax.swing.JTextArea
- javax.swing.JTextField
- java.awt.TextArea
- java.awt.TextField
I propose a moving of a text portion (as it is implemented in most M$ editors or in html-browser's text areas for example) by pressing the left mouse button in the marked text area, holding it, moving the mouse to the target text position and there releasing the left mouse button. Copying should be done by simultaneously pressing the ctrl-key.

Additionally copying should be done by simultaneously pressing the right mouse button.

Also replacing a text area with the selected text portion should be possible by additionally pressing the right mouse button at target text position and then marking the to-be-replaced text area by moving the cursor over it. Moving the selected text portion instead of coping it should then be provided by letting loose the left mouse button while holding the right mouse button.

A tool tip should indicate the actual replace/move/copy mode.




JUSTIFICATION :
Because it is implemented in most M$ editors or in html-browser's text areas for example.

ACTUAL -
Only ctrl-x ctrl-c ctrl-v is supported.
###@###.### 2005-04-13 11:21:52 GMT

Comments
EVALUATION Swing text components have had drag and drop support built-in since 1.4. The developer just needs to turn it on with setDragEnabled(true). If this were filed only against Swing, I'd close as not a bug. However, it mentions AWT text components as well. So I'll let the dragndrop team look at this and decide what they'd like to say about it. ###@###.### 2005-04-13 14:53:10 GMT AWT text components do not have built-in DnD support. One has to implement it in his/her program. It is not surprising: consider MS Notepad (which does not support DnD) vs MS Word. If one wants to use DnD for free, employ Swing text components. Another submitter's proposal is to have an ability to mark the text that are to be replaced with the dragged text. It may be somewhat useful, but it may also seem consufing. A programmer should be able to implement such a tricky feature for AWT text components if the feature is desirable. May Swing want to implement the feature for its text components? Also I believe that the feature is not prevalent. Could the submitter point me to an application (including its version) that does support such a feature? ###@###.### 2005-04-13 15:52:14 GMT Thanks for asking - Swing isn't interested in implementing the "mark-for-replace" behavior. We prefer to keep our functionality to that supported by other toolkits. The described behavior is indeed confusing. ###@###.### 2005-04-13 16:07:19 GMT The last submitter's proposal about the tooltip indicating the drop action (e.g., copy, move) is superfluous since the cursor is intended for reflecting the drop action during a DnD operation. So Swing and AWT are not going to implement anything described in this RFE. ###@###.### 2005-04-14 08:56:13 GMT
13-04-2005