'JTable multiple selection on Mac OS X

I have a Swing application and we are having a problem with some Mac users and JTable components.

The tables have this selection mode set:

setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

On Windows with this selected you can:

  1. select a single row
  2. select contiguous rows by holding the mouse and dragging
  3. select contiguous rows by clicking the first row to select, pressing shift and clicking the end row to select
  4. Select multiple groups of contiguous rows by clicking a row and drag and then holding ctrl and doing it again from a different row
  5. You can hold Ctrl down and individually select rows that are Not contiguous

On Mac OS you can only do 1 and 2. I don't care about 3 and 4, but I really need them to be able to select random rows that are not contiguous.

This is a picture of the selection behavior described in #5 which doesn't work on Mac: non-contiguous JTable selection

I generated this on windows using the standard JTable simple demo. You can't do so on Mac. You can on linux. Here is the link to that demo: docs.oracle.com/javase/tutorial/uiswing/components/table.html

Is this a known problem or is there a solution known?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source