• Post Reply Bookmark Topic Watch Topic
  • New Topic

javafx ListView

 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!!!

for show list of my database i write this code:



when open, show this:

Persone@42343
Persone@45234

why???

where is the error???
 
Rob Spoor
Sheriff
Posts: 20837
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no "error", that's just the toString() representation of your Persone objects. I don't know JavaFX, but Swing uses toString() by default to display values; you can use renderers (ListCellRenderer, TableCellRenderer, TreeCellRenderer) to modify the way objects are displayed. I'm sure JavaFX has some similar mechanism. A quick search leads me to believe that Cell / ListCell is that mechanism. From the API of ListView:
Customizing ListView Visuals

The visuals of the ListView can be entirely customized by replacing the default cell factory. A cell factory is used to generate ListCell instances, which are used to represent an item in the ListView. See the Cell class documentation for a more complete description of how to write custom Cells.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!