code: public void copyToClipboard(final int rowIndex, final int colIndex, final int width, final int height) {
          final StringBuilder sb = new StringBuilder();
          if (rowIndex == 0 && colIndex == 0 && width == getColumnCount() && height == getRowCount()) {
              for (int i = 0; i < width; i++) {
                  sb.append(getColumnName(i));
                  if (i < height - 1) {
                      sb.append("\t");
                  }
              }
              sb.append("\n");
          }
  
          for (int row = rowIndex; row < rowIndex + height; row++) {
              for (int col = colIndex; col < colIndex + width; col++) {
                  Object value = getValueAt(row, col);
                  if (value == null) {
                      value = "";
                  } else if (value instanceof JComponent) {
                      value = WidgetUtils.extractText((JComponent) value);
                  }
                  sb.append(value);
                  sb.append("\t");
              }
              sb.deleteCharAt(sb.length() - 1);
              sb.append("\n");
          }
          final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
          final StringSelection stsel = new StringSelection(sb.toString());
  
          clipboard.setContents(stsel, stsel);
      }
docs: Copies content from the table to the clipboard. Algorithm is a slight
  rewrite of the article below.
  
  @see <a href="http://www.copy--paste.org/copy-paste-jtables-excel.htm">http://www.copy--paste.org/copy-paste-jtables-excel.htm</a>