aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how to check value of cell in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to check value of cell in JTable" Watch "how to check value of cell in JTable" New topic
Author

how to check value of cell in JTable

prashant gour
Ranch Hand

Joined: Feb 07, 2006
Posts: 45
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

Joined: May 13, 2005
Posts: 41
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

Joined: Feb 07, 2006
Posts: 45
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
 
wood burning stoves
 
subject: how to check value of cell in JTable