How do i make jTable not resizable and so i cant change values in it?
Hello, i got a code that gets all the data i need from database and puts it in a jtable:
Code:
private void EsamiPranesimaiTableMethod(){
try{
String sql = "BIG SQL CODE, THAT TAKES ALL THE DATA I NEED";
pst = conn.prepareStatement(sql);
rs = pst.executeQuery(sql);
Table_EsamiPranesimai.setModel(DbUtils.resultSetToTableModel(rs));
}
catch (Exception e){
JOptionPane.showMessageDialog(null, e);
}
}
So yeah, this code displays data from database into my jtable, heres a pic:
http://i49.tinypic.com/10f80sz.png
Heres the problem:
http://i49.tinypic.com/2rh7p02.png
As you can see, i can double click on any value, and then type anything in there.. i want it to be 'un-editable', how do i do that?
Re: How do i make jTable not resizable and so i cant change values in it?
A JTable uses a TableModel that manages the data for the JTable. It's the model that decides whether or not the data is editable.
kind regards,
Jos
Re: How do i make jTable not resizable and so i cant change values in it?
Moved from New to Java.
Have you gone through the tutorial linked from the JTable API?
db