• 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

JTable editing with double click + AbstractCellEditor

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a JTable, custom cell editors obtained extending AbstractCellEditor.
Everything work fine.
However, the editing starts after a single click on the cell, but I want the editing to start after DOUBLE click.
I've seen there's a nice method in DefaultCellEditor : setClickCountToStart(int), but of course nothing similar for AbstractCellEditor.

Is there a way to start editing after a double click?
Ok I can detect double clicking using mouseEvent and using editCellAt(int,int), but of course the editing starts after the first click....

Thanks in advance!
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Reimplement the cell editor's isCellEditable method. The implementation from DefaultCellEditor.EditorDelegate, which is what's being used by DefaultCellEditor:
There's the click count you were talking about.
 
Mary Pana
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you! Works like charm
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome. Did you know that you can find the source yourself? It's in a file called "src.zip" that's located inside the JDK main folder.
 
Mary Pana
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:You're welcome. Did you know that you can find the source yourself? It's in a file called "src.zip" that's located inside the JDK main folder.


I didn't!! thank you again and sorry for the late reply!
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No problem
reply
    Bookmark Topic Watch Topic
  • New Topic