• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set up JTable row listener code

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to be more specific on what you are needing.
 
ritesh r
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic