Set a value in a certain row/col of a JTable - Java Swing

Java examples for Swing:JTable Row

Description

Set a value in a certain row/col of a JTable

Demo Code


//package com.java2s;

import javax.swing.JTable;

public class Main {
    /**//from w w w .ja v  a2  s .  c  om
     * Set a value in a certain row/col of a table
     *
     * @param table
     * @param row
     * @param col
     * @param value
     */
    public static void setTableCell(JTable table, int row, int col,
            Object value) {
        table.getModel().setValueAt(value, row, col);
    }
}

Related Tutorials