title: JTable copy value from view of cellrenderer
body: <p>I have a <code>JTable</code> with a cellrenderer and my table is non-editable. When i select a cell and copy (ctrl-c) the value, its copying not the shown in the cell, it is copying the value which store in model. How could I copy cell value which shown in table.</p>
  
  <pre><code>public class TableDemo {
  
      public static void main(String[] args) {
          Vector&lt;String&gt; values = new Vector&lt;String&gt;();
          values.add("Val1");
          values.add("Val2");
          JTable table = new JTable(new Object[][] { { "key", values },
                  { "key2", values } }, new String[] { "Col1", "Col2" });
  
          table.getColumnModel().getColumn(1).setCellRenderer(new MyTableCellRenderer());
          table.setCellSelectionEnabled(true);
          JFrame jf = new JFrame();
          jf.getContentPane().add(table);
  
          jf.setSize(500, 500);
  
          jf.setVisible(true);
      }
  }
  
  class MyTableCellRenderer extends DefaultTableCellRenderer {
  
      @Override
      public Component getTableCellRendererComponent(JTable table, Object value,
              boolean isSelected, boolean hasFocus, int row, int column) {
          super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
                  row, column);
  
          @SuppressWarnings("unchecked")
          Vector&lt;String&gt; values = (Vector&lt;String&gt;) value;
          setText(values.get(row));
  
          return this;
      }
  }
  </code></pre>