How to use jTable in java?

Editable or non editable?(jtable java)?

  • i have a frame that has 3 button and a jtable i want my program to be like this: when i havnt clicked button2 my jtable be un editable and when i click it it becomes editable!i have made it un editable in the first place with this code: table = new JTable(_data, _titles){ public boolean isCellEditable(int rowIndex, int colIndex) { return false; //Disallow the editing of any cell } }; but i dont know how i can make it editable in my secound button again!

  • Answer:

    What are you using as the editor component? If using a JTextArea, you could do something like this: table1 = new JTable(); . // other code . textarea1 = (JTextArea) table1.getEditorComponent(); textarea1.setEditable(false);

Yasy at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.