File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Mouselistner not working for a table object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Mouselistner not working for a table object" Watch "Mouselistner not working for a table object" New topic

Mouselistner not working for a table object

Smriti Anchu
Ranch Hand

Joined: Dec 21, 2004
Posts: 40
Hi all,

I have a JTable object called VTable present in the swing package. For this JTable, none of the listeners gets executed.

The above mouseListener doesnt get executed.

Or do we have to create a view only.

[ EJFH: Everyone thinks their post is urgent, yours no more so than others. ]
[ April 08, 2005: Message edited by: Ernest Friedman-Hill ]
Mohammed Ajmal

Joined: Sep 20, 2004
Posts: 29
You need to add Mouselistener to the table Header.

Try using the below code:

VTable m_table = new VTable(rowData,colNames,false); m_table.getTableHeader().addMouseListener(new java.awt.event.MouseListener(){ public void mouseClicked(MouseEvent e) { System.out.println("TEST!!!"); }

I agree. Here's the link:
subject: Mouselistner not working for a table object
It's not a secret anymore!