r/JavaFX • u/JKDSD100 • Aug 22 '20
ArrayList - Getting items
I am doing order class
And because order is dependency on the menuitem class... and because it has the arrayList and i can't ask user to enter the items to be added in the list, thus what code must i write in order to get the items and to be able to view the items
ClassDiagram, my written codes and my output is all in the screenshot below



0
Aug 22 '20
[deleted]
2
u/JKDSD100 Aug 22 '20
I am trying to get the items displayed, but the items in viewAllOrder() is empty.. Since it is arraylist so i can't ask the user to enter the items that they want thus i don know how to get the items to be added and display everything... My output is shown above
0
3
u/Ostricker Aug 22 '20
This is JavaFX subreddit. JavaFX is framework for Java that you can use to easily show user interface.
You show your methods but not whole classes. I have no idea how are you calling your methods.
Just from what I am seeing - in inputOrder() you create new order with new ArrayList() but you dont add anything to that arrayList so its empty.
Also writing everything in static manner is not great idea. You could use class properties right now.