Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

bram van gemert

Greenhorn
+ Follow
since Oct 06, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by bram van gemert


Hi everybody Just wrote this script:


When I compile there are no errors.
But when i run i get this error:

Exception in thread "main" java.lang.NullPointerException
at Database.main(Database.java:29)


Dont understand why.
Tia,
Bram
10 years ago

Campbell Ritchie wrote:I have used BlueJ and don’t like it. It allows methods to be called manually like that; you r-click the icon representing an object and can invoke its methods. It allows you to see how the method works, but doesn’t allow you to put the whole thing together to form an application.



True but I have to use it for my study.
And i dont want to use anything else cause maybe i get confused
10 years ago

Jesper de Jong wrote:Welcome to the Ranch.

As far as I can see, you're not calling the createTable() method anywhere. So it doesn't get executed and the table doesn't get made and added to the frame.



Well I use bluej and I call the method manually.
10 years ago
Hi everybody,

I started coding in java a few weeks ago and i wanted to try something new.
I created a class that connects to my database and puts all data form a column into an array list.
So far everything is working fine.
But i want to put the data from the array list into a table.
And thats where it goes wrong.
I connect to the database
I convert the information from the database to an arraylist
but if i want to show the table i get a blank screen.
this is my script:




Btw I use Bluej.
And I create a new object, I use the method putDataIntoNul, then the method createTable and then main.
10 years ago