If you really interested to keep the nodes in a group with your custom order like LIFO(Last In First Out) or FIFO(First In First Out then it’s easy from javafx with the help of javafx keyword insert , into, before.

Nodes on a Group in FILO(First In Last Out) order. I mean the updated nodes will be at the index [0] and old one nodes would just swap to index[1] and so on.

Here what i’m going to start via NetBeans 6.5.1

Create a JavaFX Project with name whatever you want. Then ya you will see a default Stage with some imports.

For LIFO:

Let’s move to upwards and code some stuff as shown below:

//....imports

var myBox = javafx.scene.layout.VBox{
    spacing:5    layoutY:30
}

var submit  = javafx.scene.control.Button {
        layoutX:150
        text: "Submit"
        action: function() {
            insert javafx.scene.text.Text {
                x: 1     y: 30
                content: input.text
            } into myBox.content

        }
    }

var input = javafx.scene.control.TextBox {
         columns: 12
         selectOnFocus: true
 }

//....Stage declaration

Output:

Output LIFO

In above code i modified to insert new Node i.e. Text in VBox before first element index(as 0). So there is no any surprise on codes it’s like a human language. That’s all now your application runs in FILO order.

For FILO

Now let’s move to FILO order I mean updated records just comes on first or just inverse than we did before. You don’t need to change whole code just modify some stuff codes as below:

 

var submit  = javafx.scene.control.Button {
        layoutX:150
        text: "Submit"
        action: function() {
            insert javafx.scene.text.Text {
                x: 1     y: 30
                content: input.text
            } before myBox.content[0]

        }
    }

Output:

Output FILO

In above code i modified to insert new Node i.e. Text in VBox before first element index(as 0). So there is no any surprise on codes it’s like a human language. That’s all now your application runs in FILO order.

Have a good day