Here you can find the source of insertTableModelListener( TableModel model, TableModelListener l, int index)
public static void insertTableModelListener( TableModel model, TableModelListener l, int index)
//package com.java2s; //License from project: Open Source License import javax.swing.event.TableModelListener; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableModel; public class Main { public static void insertTableModelListener(TableModel model, TableModelListener l, int index) /* */{/* ww w . j a v a2s .c o m*/ /* 3061 */if (!(model instanceof AbstractTableModel)) { /* 3062 */model.addTableModelListener(l); /* 3063 */return; /* */} /* 3065 */TableModelListener[] listeners = ((AbstractTableModel) model) .getTableModelListeners(); /* 3066 */for (TableModelListener listener : listeners) { /* 3067 */model.removeTableModelListener(listener); /* */} /* 3069 */for (int i = 0; i < listeners.length; i++) { /* 3070 */TableModelListener listener = listeners[i]; /* 3071 */if (index == i) { /* 3072 */model.addTableModelListener(l); /* */} /* 3074 */model.addTableModelListener(listener); /* */} /* */ /* 3077 */if ((index < 0) || (index > listeners.length - 1)) /* 3078 */model.addTableModelListener(l); /* */} }