Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to populate a TableView with data fetched from database

 
Oliver Much
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a TableView that was created in JavaFx SceneBuilder. Does anyone know how to go about populating it with data from a database? I've looked around but the sample code I get are only come in fragments which I can't really get my head around. I'm a newbie at programming in JavaFx and was hoping to find some sample code that does this at some basic beginner's level, for study.

Would really appreciate some help here. Thank you all in advance.
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Oliver,
Welcome to the Ranch!

I would like to point you to the tutorial page which explains working with TableView. Once you get going with this, you should be able to fetch data from the database and populate the table.
 
John Damien Smith
Ranch Hand
Posts: 271
13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Review this sample code for populating a ListView from a H2 database.

Try to get it running.

Once you have it running and understand it, try to adapt it to use a TableView (based on information provided in the tutorial Ranganathan linked).

If you are a newbie to JavaFX, try something different from accessing a database via a TableView - e.g. just use the JavaFX library without database integration and learn how to use the scene graph by creating something like a really drawing app.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic