void (@NotNull DataContext dataContext) { int[] rows = myTable.getSelectedRows(); int[] columns = myTable.getSelectedColumns(); StringBuilder builder = new StringBuilder(); for (int row : rows) { if (!builder.isEmpty()) builder.append('\n'); for (int col : columns) { builder.append(getCellTextValue(row, col)); if (col < myTable.getColumnCount() - 1) builder.append("\t"); } } CopyPasteManager.getInstance().setContents(new TextTransferable(builder.toString())); }