File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set up JTable row listener code

 
ritesh r
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ALL:

I am a Newbie to Jtable.
I am using the DefaultTableMOdel and the JTable(Vector rows,Vector Col).
Now I am able to display the Data from the SQL Database quite well in my JTable.
Now the problem is how to go about writing a listener to a Selected Row in the JTable.
Please help me with Source COde.
Thanking u.
Sincere Regards
Ritesh
 
ritesh r
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ALL:
I am a Newbie to Jtable.
I am using the DefaultTableMOdel and the JTable(Vector rows,Vector Col).
Now I am able to display the Data from the SQL Database quite well in my JTable.
Now the problem is how to go about writing a listener to a Selected Row in the JTable.
Please help me with Source COde.
Thanking u.
Sincere Regards
Ritesh
 
Paul Stevens
Ranch Hand
Posts: 2823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to be more specific on what you are needing.
 
ritesh r
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul
I have populated my JTable in a JInternalFrame.
Now can u help me with writing a listener which would help the user to view the details of a single row.
When a user double-clicks a single row in a JTable,he/she should be able to see the details of that single row.
This code is not working properly.
>>>>>>>>>>>>>>>>>>>Sample Code>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
I have added a MouseListener interface to my class.
jtable.addMouseListener(this);
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() == 2)
{
int index = jtable.getSelectedRow();
CommentsDialog comp=new CommentsDialog
(Issue_Tracking_t,index);

}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>End of Sample Code>>>>>>>>>>>>>>>>
Here the CommentsDialog is a Dialog Class with the parameters Issue_Tracking_t,which is catching the object populating the Jtable.The index is the selcted row of the populated Jtable.
Why is the double click of the mouse not working.
Looking to hear from you.Tell me whether I am right in choosing the Listener.
Thanking you.
Sincere REgards
R.RItesh
Originally posted by Paul Stevens:
You need to be more specific on what you are needing.

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic