How can I add a TableCellRenderer to a JTable that catches mouse events?

Scott Stanchfield

Renderers are simply "rubber stamps" that are used to paint a cell in a table. They are not live components.

You can deal with the mouse events in two ways:

  1. Add a mouse listener to the table itself, and check to see which cell the events occur on.
  2. Add a cell editor to the table

If you add a cell editor, you'll need to be sure your TableModel returns true for isCellEditable(row,column) for any cells you want to edit.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact