StringBuffer sbf = new StringBuffer();
    private void performCopy(boolean cut)    {        final String EMPTY_STRING = "";                StringBuffer sbf = new StringBuffer();                // check to ensure we have selected only a contiguous block of cells        int numRows = table.getSelectedRowCount();        int[] rowsSelected = table.getSelectedRows();                // inspector case        //int numCols = table.getSelectedColumnCount();        //int[] colsSelected = table.getSelectedColumns();        int numCols = 2;        int[] colsSelected = new int[] { 1, 2 };                /*        boolean contiguousRows =             (numRows-1) == (rowsSelected[rowsSelected.length - 1] - rowsSelected[0])            && numRows == rowsSelected.length;                boolean contiguousCols =             (numCols-1) == (colsSelected[colsSelected.length - 1] - colsSelected[0])            && numCols == colsSelected.length;                if (!(contiguousRows && contiguousCols))        {            JOptionPane.showMessageDialog(null,                    	"Invalid copy selection, only contiguous block of cells is allowed.",                    	"Invalid Copy Selection",                    	JOptionPane.ERROR_MESSAGE);            return;        }        */        // construct string        for (int i = 0; i < numRows; i++)        {            for (int j = 0; j < numCols; j++)            {                sbf.append(table.getValueAt(rowsSelected[i], colsSelected[j]));                if (j < numCols - 1)                    sbf.append("\t");                if (cut)                    table.setValueAt(EMPTY_STRING, rowsSelected[i], colsSelected[j]);            }            sbf.append("\n");        }                // do the copy        stringSelection = new StringSelection(sbf.toString());        clipboardSystem = Toolkit.getDefaultToolkit().getSystemClipboard();        clipboardSystem.setContents(stringSelection, stringSelection);    }