0

I'm trying to have a ListView of HBoxes and am currently trying to do it using FXML. This is somewhat related to JavaFX - ListView Item with an Image Button, but in bluevoxel's answer, the HBox is implemented in code.

How can I do it with FXML?

In more details: enter image description here

DayBox is a HBox with a label, and below it is a ListView. In my main application, there is a ListView of these DayBoxes.

Community
  • 1
  • 1
mxchai
  • 35
  • 7
  • I have a simple answer for you: don't try to achieve something that's not meant to be done. – Roland Mar 25 '15 at 05:10
  • @Roland what do you mean by that? Can you suggest alternative ways to achieving this then? The reason for using FXML is so that I can do styling easier than if I do it with just code. – mxchai Mar 25 '15 at 06:39
  • Why do you want to put a custom component into a ListView via FXML? A ListView contains a list which is a collection of an arbitrary number of items which may change during runtime. Just add your component via plain Java to the ListView. – Roland Mar 25 '15 at 06:43
  • @Roland You mean there's no possibility to using FXML to style the custom components? – mxchai Mar 25 '15 at 06:47
  • Yes, you can use FXML to style custom components. Only adding them to the list view isn't possible inside the FXML. – Roland Mar 25 '15 at 07:07

0 Answers0