This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Copying cell value from JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Copying cell value from JTable" Watch "Copying cell value from JTable" New topic
Author

Copying cell value from JTable

Balasubramaniam Muthusamy
Ranch Hand

Joined: Nov 30, 2010
Posts: 51
Hello Everyone,
I have a JTable with set of rows. When i click on any row just i need to copy the second cell value of that row to clipboard.. Could anyone please guide me?

Thanks
Bala
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2179
    
    7
What is your exact problem?

a) do you know how to copy a String to the clipboard?
b) do you know how to get data from a cell in the table?
c) do you know how to write a MouseListener

Start by solving "a" first, then "b", and then "c". I'm sure you can find examples on the web on how to use the clipboard. You can start by taking a look at the Clipboard API.

Why would clicking on a cause text to be copied to the clipboard. Does this mean that every time you click on a cell the text is copied? Or are you going to have a popup menu with some Actions that allow you to copy text from the cell.

Balasubramaniam Muthusamy
Ranch Hand

Joined: Nov 30, 2010
Posts: 51
Thank you so much for your response.. i am able to copy now
 
 
subject: Copying cell value from JTable