• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable.isCellSelected always returning false - problem fixed

 
Daniel Gallant
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once again, I come to drink from the well of your collective knowledge!

The problem is the isCellSelected in the Save button is always returning false, even when the cell is selected. I also tried calling the cells individually, and had the same issue. The JTable has 2 columns and 5 rows. Here is the code to setup the JTable:


Here is the code from the Save button:



In the save button optionList.getCellSelectionEnabled() is true, so I'm fairly sure the JTable is setup correctly.

If you need additional code, please let me know.

Thanks in advance!
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To increase your chances of getting help you should create a SSCCE, that demonstrates the incorrect behaviour.


 
Daniel Gallant
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found my error. I had the line optionList = new JTable(); This caused my error.

Let others be warned.
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And that is exactly why you create a SSCCE before you post a question. Simplify the problem and most times you will find your mistake.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!