Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable column that can be both editable or non-editable

 
bill moody
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, i have an application that is stuck with some JTable issues. The first of which is i have a column in my JTable that i want to be editable IF a particular RadioButton is selected, and non-editable otherwise.

Here is a code snippet that i was able to work to get columns editable in my initialization:



Does anyone have any ideas as to how i can make case 0 return true IF a radio button (independent of the JTable but on the same page of my application) is not selected, but false if it is?

A thousand thank yous to the guru who solves my problem!!!
[ December 02, 2006: Message edited by: bill moody ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Extend your TableModel to turn on/off editing based on columns, then add a listener to the checkbox to call these methods...

 
bill moody
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nathan thank you, this worked like a charm.

Well one point i would make for any future browsers of this was that attempting to integrate Nathan's code into my own, my isCellEditable method was returning false in both sides of the if condition until i realized this and adjusted my cells default values. I ended up just returning false for one side of the condition and returning true for the other side.

Once i did that, it worked like a charm!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic