wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Editable Table in SWT? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Editable Table in SWT?" Watch "Editable Table in SWT?" New topic
Author

Editable Table in SWT?

K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
I've been trying to make a very simple 2 column table with several TableItem objects (i.e rows in the table as their called). This is then "wrapped" up in a TableEditor object (as opposed to leaving it in a read-only Table object), exactly as the example shown on the Eclipse "snippets" website: http://dev.eclipse.org/viewcvs/index.cgi/platform-swt-home/snippits/snippet88.html?rev=1.3

This works great but it has one big limitation - it only allows edition of ONE column at run-time (hence the "final int EDITABLECOLUMN = 1;" in the code).

I want to be able to edit 2 columns but have failed in my attempt. How can I do it? I am reading some data in from an XML file, parsing it and placing certain elements into the Table (i.e. element name, element value - hence the 2 columns). Its trival, but I want to be able to edit both details, not just the value of the element (which is what I have now).

Any ideas? Javaworld.com had an example of TableEditor but it avoided direct editing within the TableEditor, and instead popped up a dialog for the user to edit data. I am sure SWT can do this, it seems like a basic feature of any Table Editor.

Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Editable Table in SWT?