<Swing Dev> JList MULTIPLE_INTERVAL_SELECTION

Paulo Levi i30817 at gmail.com
Sat May 5 07:31:41 UTC 2012


Glazed list as a feature, that i consider more like a bug fix:


    /**
     * A selection mode where any element may be selected and freshly added
elements
     * are always deselected. No equivalent policy exists in
     * {@link javax.swing.ListSelectionModel}
     */
    public static final int MULTIPLE_INTERVAL_SELECTION_DEFENSIVE = 103;


used like this:
DefaultEventSelectionModel esm = new DefaultEventSelectionModel(sorted);
esm.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);

I've only seen the need to use it intheir filtering classes yet (because
they are constantly adding elements)
but it really seems like a bug of MULTIPLE_INTERVAL_SELECTION.
Part of the DefaultEventSelectionModel javadoc:

 * <p>Alongside <code>MULTIPLE_INTERVAL_SELECTION</code>, this {@link
ListSelectionModel}
 * supports an additional selection mode.
 * <code>MULTIPLE_INTERVAL_SELECTION_DEFENSIVE</code> is a new selection
mode.
 * It is identical to <code>MULTIPLE_INTERVAL_SELECTION</code> in every way
but
 * one. When a row is inserted immediately before a selected row in the
 * <code>MULTIPLE_INTERVAL_SELECTION</code> mode, it becomes selected. But
in
 * the <code>MULTIPLE_INTERVAL_SELECTION_DEFENSIVE</code> mode, it does not
 * become selected.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20120505/0053e267/attachment.html>


More information about the swing-dev mailing list