Skip to main content
gamedev.net
🔒 Locked

[java] JTable beginner problem...

Started by uncutno 0 replies 200+ views
Original Post
uncutno
uncutno
Hello! Im a new java programmer... (but c++ for 5 years) that have a problem with the class JTable in the swing GUI... not a realy big problem, but i cant get it the way i want... tried to google, but got to much information that didnt have anything to do with my problem... problem: how do you set your JTable to be uneditable? I still want to select rows in my table, but i dont want anyone to be able to change the data in the cells... it would be great if anyone could answer my little question.
-Anders-Oredsson-Norway-
Sully
Sully
Create a class that extends DefaultTableModel, and provide this function (among others):

public boolean isCellEditable(int nRow, int nCol)
{
return false;
}

See the Java Tutorial "How to use Tables" for more information.
-Ron

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.