• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Table problem

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 74342
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 13013
66
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic