Hi I have a JTable with 4 columns and 8 rows. One of the columns has checkboxes with true - false values indicating that if the value of the checkbox is true, then that row should be uneditable, if the cb value is false, then the row should be editable. Please guide me with this.
The only way that I can think of to do it is to add a Listener to the table. When any KeyEvent occurs look at the checkbox, and if it is set to true, then get rid of the keystroke.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Hi sandhya, to make few rows editable u need to override boolean isCellEditable(int row,int column) method of JTable class.
actually whenever you try to edit some cell then the method isCellEditable() is fired for that row,col pair. so u can override this method to return true/false depending on whatever conditions u have. hope that was clear. regards deekasha
Hi deekasha Thanks, but I'd already solved the problem. But I guess, I picked up on the same thing as u've suggested. Thanks a lot. I'd really appreciate it if I could get a little fast response. regards Sandhya
Well, Sandhya, instead of complaining, how about answering your own question when you figure it out, so others don't spend their time and energy answering it. That's what I do. After all, we don't pay to use JavaRanch!
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>"Those who cast the votes decide nothing. Those who count the<BR>votes decide<BR>everything." <BR> -Joseph Stalin<HR></BLOCKQUOTE>
Sandhya Rprasad
Greenhorn
Joined: Mar 01, 2001
Posts: 24
posted
0
Originally posted by eric moon: Well, Sandhya, instead of complaining, how about answering your own question when you figure it out, so others don't spend their time and energy answering it. That's what I do. After all, we don't pay to use JavaRanch!
Hi Eric It was not a complain, but it was a suggestion. I'm sorry if you could'nt get to the sensitivity of the solution. If you did observe, I did thank Deekasha for the response which I certainly mean. Ofcourse I am aware that we don't pay JavaRanch to use it and yes, I did find the solution after a lot of struggle and research over the net and stuff. Yes, if the solution given to me did'nt help me much in time, which I'm not blaming, it may help someone else coming up with similar problems in the future. So, please do put your words after giving it a serious thought when you're posting on such forums .. I'd really appreciate that !!! Sandhya
Well, thanks that helped, I new how to get the rows/cols to to enabled are start, but was having trouble with the checkbox and getting thoughs rows only to be editable, with the code provided about it gave me anouther idea. So thanx for the inital posting and all the replies. , this will help me no my class final project 60% of sem grade
FoxSurfer
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: How to make only some rows editable in a JTable