Solved

Edit/UnEdit Dynamically in JTable

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I remove an object from a 3 60
maven disable workspace resolution 1 76
swing controls 2 37
Need Help! Getting a syntax error and don't understand why 3 55
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…
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 how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

732 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