Java JTable set value by row and column index
import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; public class Main extends JPanel { public Main() { setLayout(new BorderLayout(5, 5)); String[][] data = { //from w w w . jav a 2 s. c o m { "0", "0", "1", "8", "8", "9", "7" },// { "0", "0", "2", "7", "8", "8", "8" },// { "0", "0", "3", "8", "8", "9", "6" },// { "0", "0", "4", "8", "8", "9", "8" },// { "0", "0", "5", "8", "8", "9", "8" } // }; String[] colHeaders = { "Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri" }; final JTable table = new JTable(data, colHeaders); table.setValueAt("New Value", 3, 4); JScrollPane sp = new JScrollPane(table); add(sp, BorderLayout.CENTER); } public static void main(String[] args) { JFrame frame = new JFrame("java2s.com"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Main m = new Main(); frame.add(m); frame.setSize(300, 210); frame.setVisible(true); } }