Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to create a read-only JTable

 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
the cells should be selectable, but not editable. Do not find it. I am really a newby in Swing.
Thanks in advance.
Axel
 
Rene Liebmann
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Axel,
a JTable has a model behind, a TableModel. You can either implement this or you extend from the DefaultTableModel. Anyway, there is a function isCellEditable(int row, int col). This function should return false in every case, then your table is not editable, but selectable.
Ta have a good starting point, you should read the Table section of the Java Tutorial of SUN.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!