hi i studied ur post in this link
http://www.daniweb.com/software-development/java/threads/118194
but i m unable to edit the default table here is its code

jTable1 = new javax.swing.JTable();

[B]jTable1.setModel(= new javax.swing.table.DefaultTableModel([/B]
    new Object [][] {

    },
    new String [] {
        "Book Name", "Author Name"
    }
) {
    Class[] types = new Class [] {
        java.lang.String.class, java.lang.String.class
    };
    boolean[] canEdit = new boolean [] {
        false, false
    };

    public Class getColumnClass(int columnIndex) {
        return types [columnIndex];
    }

    public boolean isCellEditable(int rowIndex, int columnIndex) {
        return canEdit [columnIndex];
    }
});



jScrollPane1.setViewportView(jTable1);

this is a code generated by netbeans itself but im unable to edit the bold code i wants to edit it like this
DefaultTableModel model= new javax.swing.table.DefaultTableModel
but im invane any help would be appreatied plz help sooon

Recommended Answers

All 2 Replies

Swing tutorial is probably best place for that, there are everything about JTable inc examples, another here, if you'll have reall question, with specific problem, then don't forget to ask ...

1.open the design tab in netbeans..
2.right click on table and then table content
3.a window will pop up.under row tab u can add row..and under column tab u can add column.

happy coding...:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.