Results 1 to 5 of 5
  1. #1
    johnt is offline Super Moderator
    Join Date
    Apr 2007
    Posts
    30
    Rep Power
    0

    Default How can i set the table's column dragable/movable false and cell editable

    How can i set the table's column dragable/movable false and cell editable false in table column. If you double click on tables column then you can write any thing but i dont want to write any thing dynamically on column in table. I tried so many ways but i am not able to do.

    Please give me sample code for this..

  2. #2
    levent Guest

    Default

    How can i set the table's column dragable/movable
    false

    table.getTableHeader().setReorderingAllowed(false) ;



    and cell edittable false in table column.
    Create your own table model ad override the isCellEditable method.

  3. #3
    johnt is offline Super Moderator
    Join Date
    Apr 2007
    Posts
    30
    Rep Power
    0

    Default

    Create your own table model ad override the isCellEditable method.
    Please tell me how can i create a TableModel?

  4. #4
    levent Guest

    Default

    Something like this:

    Java Code:
    public class MyTableModel extends DefaultTableModel {
        // ...
        public boolean isCellEditable(int row, int col) {
            return false;
        }
        // ...
    }
    Or even better, extend AbstractTableModel. AbstractTableModel already overrides isCellEditable to return false.

    Java Code:
    public class MyTableModel extends AbstractTableModel {
        // ...
    }
    For more information, you can read Java Tutorial and/or look at JTable Javadoc.
    Last edited by levent; 05-19-2007 at 11:14 AM.

  5. #5
    johnt is offline Super Moderator
    Join Date
    Apr 2007
    Posts
    30
    Rep Power
    0

Similar Threads

  1. insert row and column and delete row and column
    By daredavil82 in forum New To Java
    Replies: 13
    Last Post: 09-22-2011, 06:10 PM
  2. Limiting the capacity of a cell of JTable
    By rameshraj in forum Advanced Java
    Replies: 0
    Last Post: 03-24-2008, 02:20 PM
  3. Select specific cell
    By Echilon in forum New To Java
    Replies: 1
    Last Post: 01-01-2008, 07:47 AM
  4. Jtree - making parts editable
    By kmarie in forum AWT / Swing
    Replies: 1
    Last Post: 07-27-2007, 02:34 AM
  5. hibernate lazy=False
    By Ed in forum JDBC
    Replies: 2
    Last Post: 07-02-2007, 07:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •