• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 457
  • Last Modified:

Edit/UnEdit Dynamically in JTable

Can I Edit /UnEdit cell(s) dynamically in JTable?
If yes, how?
0
j74
Asked:
j74
  • 2
1 Solution
 
zzynxSoftware engineerCommented:
You mean make cells editable/non-editable on the fly?
Yes, you can.
Use your own TableModel in which you overwrite the isCellEditable() function:

public class MyTableModel extends DefaultTableModel {

     public boolean isCellEditable(int row, int column) {
         if ( whatever you like )  // e.g. if (column==2 && row < 3)
           return false; // uneditable
         return true; // editable
     }

}
0
 
j74Author Commented:
Thanks.
0
 
zzynxSoftware engineerCommented:
:°)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now