Darryl Burke wrote:
Mitul Patell wrote:I created the JList before adding it to the panel
Not before the first time you tried to add it to the panel, you didn't.
Paul Clapham wrote:It's not that hard. When line 54 is called, the variable jlstColNames is null. You can't add null to a panel, that doesn't make sense. So either remove that line of code or put something before it which assigns a reference to some component to the variable.
Swastik Dey wrote:Which line is throwing npe? Show the exception stack trace.
Swastik Dey wrote:Try this
...
...
Swastik Dey wrote:Could you please post the updated code?
Swastik Dey wrote:Use the no-arg constructor to create Jlist object, and add it to JPanel in TableViewer2(). In fetch columns method use setListData method to set data to list. As far as the error is concerned, the error is something related to the database.
Darryl Burke wrote:
Mitul Patell wrote:Sorry for the double post. At first it told me it didn't go through. Not sure how to delete my post.
No worries. I've removed it.
Swastik Dey wrote:May be in the fetchColumns method, after the for loop ends.
Swastik Dey wrote:The second part of the code can be a method, where you can pass the selected table name, and on combo box change event, you can call that method with the selected table name.