This is the generated code:

private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        scriptTable = new javax.swing.JTable();

        setSize(new java.awt.Dimension(200, 200));

        scriptTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Number", "Name", "Dose", "Instructions", "Date Filled", "Date 
to Refill", "Date to Renew", "Date Expires”
            }
        ));
        jScrollPane1.setViewportView(scriptTable);

This is my code where I use it:

      scriptTable.getModel().setValueAt(num, row, 2);  NULL POINTER HERE
                    scriptTable.getModel().setValueAt(nam, row, 3);
                    scriptTable.getModel().setValueAt(dose, row, 4);
                    scriptTable.getModel().setValueAt(instruc, row, 5);
                    scriptTable.getModel().setValueAt(filled, row, 6);
                    scriptTable.getModel().setValueAt(tofill, row, 7);
                    scriptTable.getModel().setValueAt(torenew, row, 8);
                    scriptTable.getModel().setValueAt(expires, row, 9);

Best Regards,

Michael
On Jun 26, 2019, 4:33 AM -0700, Bayless <bk...@cox.net>, wrote:
> Or maybe you have not created the model or supplied it with starting data 
> vector.
> Bayless
>
> On 6/26/19 12:42 AM, Helmut Leininger wrote:
> > Hi Michael,
> > without more information it is very difficult to say. It could be that 
> > either scriptTable, num, or row is not set.
> > I would try to use the debugger to find out.
> > Helmut
> > Am 26.06.2019 um 01:20 schrieb mmo...@me.com.INVALID:
> > > I placed a JTable, on a JScrollPane on a JInternalFrame, using the 
> > > default DefaultTableModel.
> > >
> > > When I try and load data into the model I get a 
> > > java.lang.NullPointerException.
> > >
> > > scriptTable.setValueAt(num, row, 2);
> > >
> > > The table is initialized in the constructor method InitComponents.
> > >
> > > Any idea what I’m doing wrong?
> > >
> > > Best Regards,
> > >
> > > Michael

Reply via email to