FIFO and LIFO in javafx

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:

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:

 

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

Leave a Reply