I can not copy the selected line to Jtable, I have a Popup menu in the JTable, in which I added a copy button, and now I want to copy data from the selected timeline, but it does not work. Here is my code. Advise something.

static int row; static int column; public static void copy(){ jtb.addMouseListener(new MouseListener() { public void mousePressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { Point point = e.getPoint(); column = jtb.columnAtPoint(point); row = jtb.rowAtPoint(point); jtb.setColumnSelectionInterval(column, column); jtb.setRowSelectionInterval(row, row); } } public void mouseClicked(MouseEvent e) { // TODO Auto-generated method stub } public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } }); copy.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { StringSelection stringSelection = new StringSelection(String.valueOf(jtb .getModel().getValueAt(column,row ))); Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard(); clpbrd.setContents(stringSelection, null); } }); 

}

    0