• Post Reply Bookmark Topic Watch Topic
  • New Topic

must click 2 times after clearSelection()

 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I have a JTable and CustomTableCellRenderer that handles the cells color.

A user should be able to mark the cell as long as the cell isn't occupied. If the cell is occupied reset the selection and the user has to make another selection.

I have managed to do this but the problem is that after the table.clearSelection() method I must click on the cell 2 times to select it. Does anybody have a solution to this problem. Here is some code


[ November 21, 2005: Message edited by: P.W Mathias Nilsson ]
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know for a fact that it's not selected after one click or do you assume it's not because it hasn't changed color? When and how does a cell become locked or unlocked?
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The cell isn't selected after on click just 2.

I implemented it in another way so it's ok for now. I have another question

If a user selects a locked cell, then all the other cell that is selected should change color. Some kind of collition. If the user selects cells that isn't allowed then the whole selection should be invalid.

// Mathias
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!