Creating a Table A table fires change events when the contents of one of its cells is modified. Object[][] cellData = { {"row1-col1", "row1-col2"}, {"row2-col1", "row2-col2"}}; String[] columnNames = {"col1", "col2"}; JTable table = new JTable(cellData, columnNames); // The next two lines should be in one line. table.getModel().addTableModelListener( new MyTableChangedListener()); // Make the table scrollable. JScrollPane scrollPane = new JScrollPane(table); // The next two lines should be in one line. class MyTableChangedListener implements TableModelListener { public void tableChanged(TableModelEvent evt) { int row = evt.getFirstRow(); int column = evt.getColumn(); // The next three lines should all be in one line. Object data = ((TableModel)evt.getSource()).getValueAt( row, column); process(data); } }