Solved

Edit/UnEdit Dynamically in JTable

Posted on 2004-10-20
3
433 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 250 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now