Solved

Edit/UnEdit Dynamically in JTable

Posted on 2004-10-20
3
441 Views
Last Modified: 2008-01-09
Can I Edit /UnEdit cell(s) dynamically in JTable?
If yes, how?
0
Comment
Question by:j74
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

691 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