[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Edit/UnEdit Dynamically in JTable

Posted on 2004-10-20
3
Medium Priority
?
452 Views
Last Modified: 2008-01-09
Can I Edit /UnEdit cell(s) dynamically in JTable?
If yes, how?
0
Comment
Question by:j74
  • 2
3 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 1000 total points
ID: 12367078
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
 

Author Comment

by:j74
ID: 12369221
Thanks.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12369369
:°)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn different types of Android Layout and some basics of an Android App.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month20 days, 8 hours left to enroll

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question