1

I've created a jTable on netbeans (drag and drop from swing controls) and then populated it with data from SQL database. I then added a mouseclicked event so that when it is clicked, another jFrame will open.

My problem is, when I double-click on a cell, it becomes editable. Any suggestions to make it non-editable? If isCellEditable is a solution? where should it be placed as I got no idea where my jTable properties code is since i created it visually

shelda
  • 13
  • 6
  • Please include your code. – Jason D Oct 04 '15 at 05:11
  • "I got no idea where my jTable properties code is since i created it visually" :( i didnt write code to create the jTable, just used GUI design in Netbeans. How can I view this auto generated code? – shelda Oct 04 '15 at 05:22

2 Answers2

1

Here are some sources that can help you solve your problem. If you cannot find the exact code of the jTable, you can refer to the first link. Otherwise, you can refer to the second link.

Link 1: Customizing code by adding isCellEditable

Link 2: Adding table.setFocusable(false); table.setRowSelectionAllowed(true); to the jTable

Community
  • 1
  • 1
nubteens
  • 5,462
  • 4
  • 20
  • 31
1

You can also right click the jTable, click 'Table Contents', 'Columns'. Then uncheck all the boxes in the 'Editable' column.

Jing Ma
  • 183
  • 2
  • 12