Search code examples
javajtable

How can I get the text in a JTable?


For example I have a Table that I want to get text that's in the first column and store it in an ArrayList.


Solution

  • Java Tables often use the TableModel interface for storage.

    You can get the a particular value via:

    myJTable.getModel().getValueAt(rowIndex, columnIndex);
    

    More on that: Sun's Swing Table Tutorial