• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Table problem

 
bram van gemert
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15354
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
bram van gemert
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15354
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok... I don't know how BlueJ works and how you can call your methods "manually".

A normal Java program starts running at the main method. That method should look like this:

public static void main(String[] args)

Your main method isn't static, and it doesn't have the required String[] argument. So, you can't run this like a regular Java program.

If you somehow manually call these methods from BlueJ, then you should make sure that you call the createTable() method on the same object as the 'connect' object that is called in the main() method. Otherwise you're creating the table in a different object than the 'connect' object that you show in the main() method. You could try adding a line after line 116:
 
Campbell Ritchie
Sheriff
Pie
Posts: 49363
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
bram van gemert
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
fred rosenberger
lowercase baba
Bartender
Posts: 12143
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bram van gemert wrote:And i dont want to use anything else cause maybe i get confused

And that is your choice to make, but you should realize that since you are doing things in a non-standard way, you are limiting who can help you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic