Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Table problem

 
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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • 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
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • 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:
 
Marshal
Posts: 69847
278
  • 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
 
lowercase baba
Posts: 12871
62
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.
    Bookmark Topic Watch Topic
  • New Topic