• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

SWT/JFace  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to make a table cell editable.
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
you can use the setText() method of the TableItem.
it can take an array and it knows to place the data correctlly.
for example:



now, to edit , you need to edit the line( the row) so I guess you keep your information in some kind of a ArrayList ( in my example I only enterd one row('array') to the table, you can add as many as you want ofcourse )
so what you could do, is use the " table.removeAll() " method to earase the table , and then restart it with your fixed data .
Hope I was helpfull, if not, ask again.
Dave
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dave,
Do you know how to set any property of a cell ?
you put the texts in an array then you set the array in the table.
But, how to set the foreground of a specific cell and not the entire row, for example ?

Regards,
 
Dave Jones
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, no prob
the TableItem has a few methods- setText , setBackground.
If you want to change a specific box, use the one with the index :


hope I helped!
if not, ask again and I'll answer you(if I can) tomorrow morning.
Dave
 
Eusebio Floriano
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave,
It�s exactly what i needed.
Thx a lot.

Regards,
Vinicius
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Dave,

I'm trying to create a table with SWT/JFACE.

I want to create a table where the user can select a row by using one click-button. But I want the user editing a cell by double-click on it.

I already have a content provider, label provider on my table viewer.

My table has 4 text cell editors and 1 cell combo editor on the table viewer. I also have a cell modifier on the table viewer.

Can you help me ???

If it's not clear enough, just let me know. I'm French and some times it's difficult to explain the problem

Thanks a lot.

ben
[ May 11, 2005: Message edited by: Ben AMIOT ]
 
Ben AMIOT
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave,

I don't need help anymore. I found a lot of information here Snippets.

Maybe later.

Thanks

ben
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!