0
                     found1[found].setText(s1);
                     found2[found].setText(s2);
                     found3[found].setText(s3);
                     found4[found].setText(s4);
                     found5[found].setText(s5);
                     found6[found].setText(s6);
                     found7[found].setText(s7);
                     found8[found].setText(s8);

Here found1[10], ....... , found8[10] are the name of JLabel and I want to name them as per the String name s1, s2, s3..... ,s8 whose names are assigned in the way as shown below:

                     String s1=String.valueOf(rs.getInt(1));
                     String s2=rs.getString(2);
                     String s3=String.valueOf(rs.getInt(3));
                     String s4=rs.getString(4);
                     String s5=rs.getString(5);
                     String s6=rs.getString(6);
                     String s7=rs.getString(7);
                     String s8=String.valueOf(rs.getInt(8));

Here rs is an object of ResultSet class and I am accessing data from table of database. All other codes are correct but I get runtime error every time when I reach at this code.

  • Could you please share more details, Atlest share stack trace. – Shadab Siddiqui Jul 20 '18 at 03:46
  • 1
    And even if this wouldn't be a duplicate, we would need a [mcve] to help you. I am guessing that your result set does not contain the data you expect it to contain. – GhostCat Jul 20 '18 at 03:47
  • CAUGST AN EXCEPTION IN TRY BLOCKjava.lang.NullPointerException at MainProgram.DELETE_ENTRY_GRAPHICAL_EDITING.actionPerformed(DELETE_ENTRY_GRAPHICAL_EDITING.java:159) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) – Aman Dhakal Jul 20 '18 at 03:50

0 Answers0