Source Code : Discard any changes made by the user and stops the editing process

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Discard any changes made by the user and stops the editing process

 

import javax.swing.JTable;

public class Main {
  public static void main(String[] argv) throws Exception {
    int rows = 10;
    int cols = 5;
    JTable table = new JTable(rows, cols);

    table.setColumnSelectionAllowed(true);
    table.setRowSelectionAllowed(true);

    int row = 1;
    int col = 3;
    boolean success = table.editCellAt(row, col);
    if (success) {
      boolean toggle = false;
      boolean extend = false;
      table.changeSelection(row, col, toggle, extend);
    }
    if (table.getCellEditor() != null) {
      table.getCellEditor().cancelCellEditing();
    }
  }
}

   
  

Thank with us