JDK-4656461 : Cannot Ctrl-Shift-Click to create disjoint selection interval in list
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2002-03-21
  • Updated: 2017-05-16
  • Resolved: 2005-01-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
1.4.2_10Fixed 6 b20Fixed
Description

Name: jk109818			Date: 03/21/2002


FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)


Observed on RedHat Linux 6.1, JDK 1.4.0 and 1.3.1_02, kernel
2.2.12, Enlightenment window manager. Same on Win2K/1.4.0.

A DESCRIPTION OF THE PROBLEM :
In Metal L&F, I would expect that the gesture
Ctrl-Shift-Click on a list or tree would extend a selection
from the previously selected item (like Shift-Click does)
without clearing other disjoint selections (like Ctrl-Click
does). At least on Windows, this is normal behavior, and I
expected it to work in Metal L&F as well, but it did not.

Compare NetBeans/Forte for Java bug, closed as a Swing
problem:

http://www.netbeans.org/issues/show_bug.cgi?id=3714

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run demo program. Click "one" in the list. Ctrl-click
"three". Ctrl-shift-click "five".

EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: one, three, four, and five are selected. Actual:
one, three, and five are selected, but four is not - same as
if the last step had been to ctrl-click "five" without the
Shift modifier.

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
public class TreeSelectionTest {
    public static void main(String[] args) {
        JTree tree = new JTree(new Object[] {
            "one",
            "two",
            "three",
            "four",
            "five",
        });
        JList list = new JList(new Object[] {
            "one",
            "two",
            "three",
            "four",
            "five",
        });
        JFrame f = new JFrame("Test tree selection");
        f.getContentPane().add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tree,
list));
        f.pack();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
    }
}

---------- END SOURCE ----------

CUSTOMER WORKAROUND :
If no long ranges (only short ones) need be selected, just
use Ctrl-click for every item. If only one long range need
be selected, do it first with Shift-click, then add
individual items with Ctrl-click. If more than one long
range needs to be selected, you are out of luck.
(Review ID: 144376) 
======================================================================

Comments
EVALUATION Yes, it would be nice to implement this behavior. ###@###.### 2003-08-05 Fix is in progress. Table, tree, and list will be changed to support this type of selection. The fix involves minor changes in BasicListUI, BasicTableUI, and BasicTreeUI to handle the CTRL-SHIFT combination. In addition, the spec of JTable.changeSelection will change slightly. ###@###.### 2005-1-05 16:32:03 GMT
05-01-2005