This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTable question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable question" Watch "JTable question" New topic
Author

JTable question

igwe kalu kalu ogba
Ranch Hand

Joined: Feb 03, 2005
Posts: 133
Hello, I'm having this problem with JTables.

I created one by using the following code:

JTable table = new JTable(4,2) {
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
};

But, the thing is, I only want the 1st column of every row to be uneditable. It is supposed to be like a key/value pair. How can I make only the second column of each of my rows to be editable. Thank you.
Lionel Badiou
Ranch Hand

Joined: Jan 06, 2005
Posts: 140
You may try to check columnIndex == 1...

Hope that helps,


Lionel Badiou
CodeFutures Software
igwe kalu kalu ogba
Ranch Hand

Joined: Feb 03, 2005
Posts: 133
Um, it doesn't work, where do I put columnIndex == -1; thanks.
igwe kalu kalu ogba
Ranch Hand

Joined: Feb 03, 2005
Posts: 133
Ok, I figured it out, this is the code I used instead:

JTable table = new JTable(4,2) {
public boolean isCellEditable(int rowIndex, int columnIndex) {

boolean returnValue = false;

if (columnIndex == 1) {
return true;
}//end if

return returnValue;
}
};
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable question
 
Similar Threads
JTable
JTable
JTable
jtable
jtable