Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

disable witing in specific cells in JTable

 
za sa
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all;
I am a beginner in programming, and this course I suppose to create Sudoku generator by using java in NetBeans
So far I did the code for generating numbers in a JTable and show the whole solution upon request
But I am straggle in how to disable writing in the visible numbers or the visible cells but enable in the empty cells
I used this code but as it is cleat it disable typing in the whole table

workSheetTable.getCellEditor();

Also I cant think of a way that enables me to get the answer from the empty cells and compare it with the actual solution!!!

Could you help me please in this !
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> But I am straggle in how to disable writing in the visible numbers

for the cells where numbers are supplied by the game you override
table.isCellEditable() to return false, and to return true for the
empty cells. you could also use the model.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic