EVALUATION
Name: dsR10078 Date: 06/21/2001
Pure AWT text components are based on the native window objects:
XmText and XmTextField widgets on X11, EDIT controls on Win32. All of
them clear the current selection on left mouse button press. When the
left mouse button is pressed we cannot predict whether the drag
gesture will be eventually recognized or not, so we have to follow the
default behavior and clear the current selection.
The desired behavior can be implemented for Swing text components with
enabled drag operation.
======================================================================
The reason that this occurs in Swing is that we use the caret to show the insert location. Ideally, we should not use the caret and use another means to show this location. By doing this we can avoid changing the selection. A similar change should be made for other components that use selection to show the insert location. I am changing the description and synopsis to reflect the source of the problem.
###@###.### 2001-11-13
See also 5077753. The behavior we decide on should likely be customized to act like the associated native platform for each L&F.
###@###.### 2004-07-23
A fix for this bug has been made! JTextComponent, JList, JTable and JTree now all have a new setDropMode(DropMode) method. This method controls how the components track and indicate their drop location. The new drop modes and the components that support them are:
USE_SELECTION - JTextComponent, JList, JTable, JTree
ON - JList, JTable, JTree
INSERT - JTextComponent, JList, JTable, JTree
INSERT_ROWS - JTable
INSERT_COLS - JTable
ON_OR_INSERT - JList, JTable, JTree
ON_OR_INSERT_ROWS - JTable
ON_OR_INSERT_COLS - JTable
The default drop mode for all components will be USE_SELECTION (which uses the selection to track the drop location), for backward compatibility. However, the new drop modes offer better options for tracking and indicating the drop location, without affecting the component's selection.
Each of these components will also have a new getDropLocation() method which will return a subclass of TransferHandler.DropLocation, customized to indicate the drop location as it makes sense for that component type. This getDropLocation() method is intended for use by UI code that renders the drop location. Additionally, the DropLocation will be passed to canImport, shouldIndicateAnyway, and importData of TransferHandler so that the behavior can be customized based on drop location.
###@###.### 2005-06-01 17:30:40 GMT
|