0

hi i had created a Jtable Which Stores Data like below
--------------------------------------------------------
a b c d e
w q 1 2 9
--------------------------------------------------------

i want to get the cell value when i click to the cell... i tried lot but not got hte out put please help to get the output please

4
Contributors
6
Replies
8
Views
6 Years
Discussion Span
Last Post by moutanna
0

use

myTable.getValueAt(selectedRow,selectedColumn);

which returns an Object


hi i had created a Jtable Which Stores Data like below
--------------------------------------------------------
a b c d e
w q 1 2 9
--------------------------------------------------------

i want to get the cell value when i click to the cell... i tried lot but not got hte out put please help to get the output please

0

thanks for your answer but the selected row and column value is differ for each click

0

so, your selectedRow would be

myTable.getSelectedRow()

and your selectedColumn would be

myTable.getSelectedColumn()

thanks for your answer but the selected row and column value is differ for each click

0

Retreiving the data value in cell could be done by creating a class that implements ListSelectionListener and passed it as argument to the ListSelectionModel of the table and to the ListSelectionModel of ColumnModel of the given table.
hope it helps.

0

this approche will give the value of the cell if you click on or if you use the keyboard button navigaiton.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.