benjamin84 / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

[fest-swing] Select multiple items in a JList and JTree #64

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
From Fabien Barbero:

Hi,
I search a method to select many elements in a JList and/or a JTree.
Is threre a way to do it ??

Original issue reported on code.google.com by Alex.Rui...@gmail.com on 3 Dec 2007 at 2:36

GoogleCodeExporter commented 9 years ago
Currently it is possible, but it requires too much code:

// import org.fest.swing.util.Platform. controlOrCommandKey;
dialog.list("someList").pressKey(controlOrCommandKey())
                       .selectItem("two")
                       .selectItem("three")
                       .releaseKey(controlOrCommandKey());

The code above will press either the "Control" or "Command" button (depending 
if you
are using Windows, OSX, etc.) and then selects the items "two" and "three" from 
the
JList (plus the selection mode of the JList needs to be 
MULTIPLE_INTERVAL_SELECTION).

We need to add a shortcut method...something like this:

dialog.list("someList").selecteItems("two", "three").

The same applies for the JTree. 

Original comment by Alex.Rui...@gmail.com on 3 Dec 2007 at 2:37

GoogleCodeExporter commented 9 years ago
You will probably need to distinguish between selecting item 3 to 8 (and all in
between, using SHIFT) and just wanting to select item 3 and 8 (using CONTROL)

Wim

Original comment by wim.debl...@gmail.com on 5 Dec 2007 at 7:38

GoogleCodeExporter commented 9 years ago
Added support for JList. Filing another issue for JTrees.

Original comment by Alex.Rui...@gmail.com on 5 Dec 2007 at 4:34