my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Table problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Table problem" Watch "Table problem" New topic
Author

Table problem

bram van gemert
Greenhorn

Joined: Oct 06, 2011
Posts: 4
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

Joined: Aug 16, 2005
Posts: 14114
    
  16

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
bram van gemert
Greenhorn

Joined: Oct 06, 2011
Posts: 4
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

Joined: Aug 16, 2005
Posts: 14114
    
  16

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

Joined: Oct 13, 2005
Posts: 38441
    
  23
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

Joined: Oct 06, 2011
Posts: 4
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

Joined: Oct 02, 2003
Posts: 11250
    
  16

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Table problem