• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Populating TableView — JavaFX SQLite  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I have been working on this for a couple of days. I have exhausted very many possible solutions. I need a fresh pair of eyes to see what it is that I am doing wrong. I understand this may be a duplicate question, however I feel that this is not a duplicate scenario.

I am able to connect successfully to the db and make querys.

I cannot get the tableview to populate. Any help would be greatly appreciated!

StackOverflow and Reddit were of little to no help.

https://pastebin.com/JyHdw1Mi -- BookScreenController.java




https://pastebin.com/973SMJZM -- Book.java




https://pastebin.com/cxdDePS9 -- bookScreen.fxml

You can see from some of the comments what I have tried to accomplish my goal


 
Sheriff
Posts: 5931
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see several things going on here, but let's start with the most likely.

In your Book model, you have a naming convention wrong.  Normally this just makes it harder for someone else to understand your code, but in this situation I think it's stopping JavaFX from recognizing your model properties.  You have methods like this:
...that should look like this:
I think without that get in the method name, JavaFX doesn't know how to find the property method.  Now uncomment 67-71 in BookScreenController.
 
Cody Sdev
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. So I have changed the getter methods for the Simple properties and uncommented the lines. I run it in debug to the refresh and the table is populating, however, nothing in the ui tableview.
 
Knute Snortum
Sheriff
Posts: 5931
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand.  Are you saying that you can see the TableView populating while debugging the code, but you can't see any data in the TableView itself?
 
Cody Sdev
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Precisely. I can see that it is being created but it is not being displayed in the tableview
 
Knute Snortum
Sheriff
Posts: 5931
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I need to see the code of BookScreenController again to see how you modified it.
 
Cody Sdev
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Book.java



Also included book class to show new getters
 
Knute Snortum
Sheriff
Posts: 5931
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would comment out lines 90 - 94.  You are setting the cell value factory twice and I don't think the second way is correct.
 
Cody Sdev
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did that before I posted last and it also didn't work. Idk what is going on here. I am at a dead end
 
Knute Snortum
Sheriff
Posts: 5931
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's try something.  I don't know if it's the problem, but I've never seen that TableView and TableColumns be static before.  Also, if you use @FXML you should use private as the access modifier.  So,
Also, I don't think the ResultSet should be static either.
 
Cody Sdev
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welp, That fixed my problem! You are an absolute life saver. Thank you for taking the time to help me figure this out.
 
Knute Snortum
Sheriff
Posts: 5931
155
Chrome Eclipse IDE Java Postgres Database Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome, and wow, thanks for all the pie!
 
It wasn't my idea to go to some crazy nightclub in the middle of nowhere. I just wanted to stay home and cuddle with this tiny ad:
ScroogeXHTML - the small and fast RTF to HTML converter library
https://coderanch.com/t/707504/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!