0

I know my title is a little too generic, but I sincerely have no idea how to ask it. So, the topic is JavaFX. I have a part of the interface coming from a fxml file and another part that I'd like to code manually. So my question is, more specifically, is there a way to insert a sort of pane into another, coming from scene builder? If you have "questions about my question", please, ask me!

lucad93
  • 45
  • 6
  • 1
    Might help. https://stackoverflow.com/questions/17122084/how-to-add-children-component-and-new-attribute-to-custom-javafx-control – Alex Dec 31 '18 at 11:09
  • 2
    I've no idea where we'd need to start with the explanation. Controller classes? Modifying a scene from java code? Injection of fields? – fabian Dec 31 '18 at 13:10
  • I think "modify a scene from java code", but the problem is that I've no idea where insert the code – lucad93 Dec 31 '18 at 13:43
  • 1
    I recommend you take a couple of JavaFX tutorials. The [official Oracle tutorials](https://docs.oracle.com/javafx/2/get_started/jfxpub-get_started.htm) are a decent introduction. – Zephyr Dec 31 '18 at 14:18
  • 1
    http://gjf2a.blogspot.com/2015/01/dynamically-adding-javafx-controls.html – SedJ601 Dec 31 '18 at 16:14

1 Answers1

0

Ok, I managed to dynamically add a label on button click, thanks to your suggestions. Anyway, i tried to add imageviews, but i get a lot of error! This is my code:

        ImageView pages[] = new ImageView[8];
    for (int i=0; i<8; i++) {
        pages[i] = new ImageView(new Image(FlowLayout.class.getResourceAsStream("src/provaProgetto/Penguins.jpg")));
        base.getChildren().add(pages[i]);
    }

What's wrong?

lucad93
  • 45
  • 6
  • 1
    Ask a new question don't post another question as an answer. Post how you solved your problem accept the answer then post a new question with your new question – Matt Jan 02 '19 at 14:08