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

how to check value of cell in JTable

 
prashant gour
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Jtable and want to check any empty cell on action event of JButton and to set focus on that particular empty cell. if any body encounter with same task please help me out.
Thanks in advance !!!
 
Cp Baherwani
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Loop thru the rows and columns for table.getModel().getRowCount() and table.getModel().getColumnCount() number of times.

Check the value of each cell with
table.getModel().getValueAt(row,col)

When found
table.setRowSelectionInterval(row,row);
table.setColumnSelectionInterval(col,col);
[ May 16, 2006: Message edited by: Chandra Prakash Baherwani ]
 
prashant gour
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ThnX Chandra Now i am able to check the value at any cell but still i am not able to set focus on that cell. i want to set mouce cursor on that cell .

one more problem when i make any change in cell and focus is still in that cell. value does not set to model. but as i lost the focus from cell, value has been set to model.

so can i set value to model while insert update of cell.

please Help me out
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic