• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Table Selection Question

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to allow the user to select any number of arbitrary cells in a JTable. I have set the selection mode for the column and row selection models to multiple selection mode. This seems to be the only setting that will allow users to select any cell (as opposed to contiguous cells, or one cell), but it is not behaving correctly.
Example:
A table with 2 rows and two columns
A1 A2
B1 B2
The user wants to select A1 and B2. A1 is selected (the user is now holding down the 'ctrl' key), and then B2 is selected. When B2 is selected A2 is also selected. If they picked A2 and then B1, A1 would also be selected.
The table also has these booleans set:
setRowSelectionAllowed(true);
setColumnSelectionAllowed(true);
setCellSelectionEnabled(true);
I'm reading in an excel file, comparing the cells versus an xml document that maps the metadata contained in the excel file, and then marks up the appropriate cells by assigning them appropriate cell renderers. I don't think this has anything to do with my problem, but I'm including it for throughness.
Any help would be apreciated,
Michael Crutcher
Texas A&M University
 
There is no "i" in denial. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic