• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

jtable selecting only one column

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!
i have a table with 2 columns... at the moment both columns are editable. lets describe my problem:
i only want to edit the second column. the first column should be static...
i tried the method:
-> setEditingColumn( 2 ); but nothing special happened?
can anybody outthere help me?
greetings
Steffen
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should use a tableModel implementing the method isCellEditable

Example
class YourTableModel extends AbstractTableModel
{
public boolean isCellEditable(int row, int col)
{
boolean isCellEditable;
isCellEditable = (col==1) | | (col==3);
/* I think the column numering is from 0 to n-1 if n
columns in table */
return isCellEditable;
}
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!